Tweaks
This commit is contained in:
@@ -3,4 +3,4 @@ machine_name: archive_tree
|
||||
type: module
|
||||
description: 'Provides an Archive tree block.'
|
||||
core_version_requirement: ^10 || ^11
|
||||
package: Custom
|
||||
package: Other
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
archive_tree_styles:
|
||||
archive_tree:
|
||||
version: 1.x
|
||||
css:
|
||||
theme:
|
||||
|
||||
@@ -1,67 +0,0 @@
|
||||
langcode: en
|
||||
status: true
|
||||
dependencies:
|
||||
module:
|
||||
- node
|
||||
id: archive_by_year
|
||||
label: 'Archive by year'
|
||||
description: 'Lists all content for a given year.'
|
||||
module: views
|
||||
display:
|
||||
page_1:
|
||||
display_plugin: page
|
||||
id: page_1
|
||||
display_title: 'Archive by year'
|
||||
position: 0
|
||||
display_options:
|
||||
path: 'archive-tree/%'
|
||||
arguments:
|
||||
created_year:
|
||||
id: created_year
|
||||
table: node_field_data
|
||||
field: created
|
||||
default_action: empty
|
||||
exception: ''
|
||||
title_enable: true
|
||||
title: 'Archive for year %1'
|
||||
default_argument_type: fixed
|
||||
default_argument_options:
|
||||
argument: ''
|
||||
summary:
|
||||
sort_order: asc
|
||||
number_of_records: 0
|
||||
format: default_summary
|
||||
base_path: ''
|
||||
count: true
|
||||
limit: 0
|
||||
plugin_id: date
|
||||
date_format: 'Y'
|
||||
granularity: year
|
||||
filters:
|
||||
status:
|
||||
id: status
|
||||
table: node_field_data
|
||||
field: status
|
||||
value: '1'
|
||||
provider: node
|
||||
fields:
|
||||
title:
|
||||
id: title
|
||||
table: node_field_data
|
||||
field: title
|
||||
label: 'Title'
|
||||
alter:
|
||||
make_link: true
|
||||
path: 'node/[nid]'
|
||||
sort:
|
||||
created:
|
||||
id: created
|
||||
table: node_field_data
|
||||
field: created
|
||||
order: DESC
|
||||
pager:
|
||||
type: some
|
||||
options:
|
||||
items_per_page: 20
|
||||
style:
|
||||
type: default
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
namespace Drupal\archive_tree\Plugin\Block;
|
||||
|
||||
use Drupal\Core\Block\BlockBase;
|
||||
use Drupal\Core\Block\Attribute\Block;
|
||||
use Drupal\Core\Block\BlockBase;
|
||||
use Drupal\Core\StringTranslation\TranslatableMarkup;
|
||||
use Drupal\Core\Form\FormStateInterface;
|
||||
use Drupal\node\Entity\NodeType;
|
||||
@@ -13,7 +13,7 @@ use Drupal\node\Entity\NodeType;
|
||||
* Provides an 'Archive tree' block.
|
||||
*/
|
||||
#[Block(
|
||||
id: "archive_tree_block",
|
||||
id: "archive_tree",
|
||||
admin_label: new TranslatableMarkup("Archive tree"),
|
||||
category: new TranslatableMarkup("Menus")
|
||||
)]
|
||||
@@ -64,7 +64,7 @@ class ArchiveTreeBlock extends BlockBase {
|
||||
$this->configuration['content_types'] = $selected_types;
|
||||
}
|
||||
|
||||
public function build() {
|
||||
public function build(): array {
|
||||
$storage = \Drupal::entityTypeManager()->getStorage('node');
|
||||
$types = array_filter($this->configuration['content_types']);
|
||||
if (empty($types)) {
|
||||
@@ -123,7 +123,7 @@ class ArchiveTreeBlock extends BlockBase {
|
||||
'#allowed_tags' => ['details', 'summary', 'a', 'div'],
|
||||
'#attached' => [
|
||||
'library' => [
|
||||
'archive_tree/archive_tree_styles',
|
||||
'archive_tree/archive_tree',
|
||||
],
|
||||
],
|
||||
'#cache' => [
|
||||
|
||||
Reference in New Issue
Block a user