This commit is contained in:
2026-01-24 10:44:29 -06:00
parent efd0d76f9b
commit 8797b7c96e
4 changed files with 6 additions and 73 deletions

View File

@@ -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' => [