Skip to content
Snippets Groups Projects

Issue #3371646: Add option to have default setting for providing menu link

Open Issue #3371646: Add option to have default setting for providing menu link
1 unresolved thread
1 unresolved thread

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
5 * Post update functions for menu_ui.
6 */
7
8 /**
9 * Adds link_by_default config in node.type.*.third_party.menu_ui settings.
10 */
11 function menu_ui_post_update_add_link_by_default() {
12 $config_factory = \Drupal::configFactory();
13 foreach ($config_factory->listAll('node.type.') as $node_type_config_name) {
14 $node_type_settings = $config_factory->getEditable($node_type_config_name);
15 $node_type_third_party_menu_ui_settings = $node_type_settings->get('third_party_settings.menu_ui');
16 if (is_null($node_type_third_party_menu_ui_settings)) {
17 continue;
18 }
19 $node_type_third_party_menu_ui_settings['link_by_default'] = FALSE;
20 $node_type_settings->set('third_party_settings.menu_ui', $node_type_third_party_menu_ui_settings)->save(TRUE);
  • Comment on lines +8 to +20

    This is not how to set third party settings or update configuration entities. This should be written to use the \Drupal\Core\Config\Entity\ConfigEntityUpdater class. See \system_post_update_add_description_to_entity_form_mode() for an example.

  • Please register or sign in to reply
Please register or sign in to reply
Loading