Skip to content
Snippets Groups Projects

Split update hooks

1 file
+ 15
2
Compare changes
  • Side-by-side
  • Inline
+ 15
2
@@ -81,7 +81,7 @@ function menu_link_attributes_update_8001(&$sandbox) {
}
/**
* Add labels and description to default menu item attributes for clarification.
* Add "Container class(es)" attribute to default attributes.
*/
function menu_link_attributes_update_8002(): void {
$attributes = \Drupal::configFactory()
@@ -96,7 +96,20 @@ function menu_link_attributes_update_8002(): void {
];
}
// Only set if still existing in custom config:
\Drupal::configFactory()
->getEditable('menu_link_attributes.config')
->set('attributes', $attributes)->save();
}
/**
* Add labels and description to default menu item attributes for clarification.
*/
function menu_link_attributes_update_8003(): void {
$attributes = \Drupal::configFactory()
->get('menu_link_attributes.config')
->get('attributes');
// Only set labels and description if still existing in custom config:
if (isset($attributes['class'])) {
// Only set if not yet set custom:
if (empty($attributes['class']['label'])) {
Loading