'#attributes' =>
[ 'class' =>
['js-layout-builder-filter'
],
'title' =>
$this->
t('Enter a part of the block name to filter by.'
),
],
];
$block_categories['#type'
] = 'container';
$block_categories['#attributes'
]['class'
][] = 'block-categories';
$block_categories['#attributes'
]['class'
][] = 'js-layout-builder-categories';
$block_categories['#attributes'
]['data-layout-builder-target-highlight-id'
] =
$this->
blockAddHighlightId($delta,
$region);
$definitions =
$this->blockManager->
getFilteredDefinitions('layout_builder',
$this->
getPopulatedContexts($section_storage),
[ 'section_storage' =>
$section_storage,
'delta' =>
$delta,
'region' =>
$region,
]);
$grouped_definitions =
$this->blockManager->
getGroupedDefinitions($definitions);
foreach ($grouped_definitions as $category =>
$blocks) { $block_categories[$category]['#type'
] = 'details';
$block_categories[$category]['#attributes'
]['class'
][] = 'js-layout-builder-category';
$block_categories[$category]['#open'
] = TRUE;
$block_categories[$category]['#title'
] =
$category;
$block_categories[$category]['links'
] =
$this->
getBlockLinks($section_storage,
$delta,
$region,
$blocks);
}