1 layout_menu_item.class.inc LayoutMenuItem::save()

Save a menu item configuration.

File

core/modules/layout/includes/layout_menu_item.class.inc, line 150
Class for storing information about menu item entries.

Class

LayoutMenuItem
@file Class for storing information about menu item entries.

Code

function save() {
  // Convert all properties to an array.
  $data = array(
    'name' => $this->name,
    'title' => $this->title,
    'path' => $this->path,
    'menu' => $this->menu,
    'conditions' => array(),
    'arguments' => $this->arguments,
  );

  // Convert all conditions.
  foreach ($this->conditions as $condition) {
    unset($condition->is_new);
    $data['conditions'][] = array(
      'plugin' => $condition->plugin,
      'data' => $condition->toArray(),
    );
  }

  config('layout.menu_item.' . $this->name)
    ->setData($data)
    ->save();
  layout_reset_caches();
  menu_rebuild();
}