1 layout_menu_item.class.inc LayoutMenuItem::__construct($data)

Constructor for LayoutMenuItems.

File

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

Class

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

Code

function __construct($data) {
  foreach ($data as $key => $value) {
    $this->$key = $value;
  }

  // Ensure defaults for menu settings.
  if (empty($this->menu)) {
    $this->menu = array();
  }
  $this->menu += array(
    'type' => 'none',
    'title' => '',
    'weight' => 0,
    'name' => 'main-menu',
  );
  if (!isset($this->menu['parent'])) {
    $this->menu['parent'] = array();
  }
  $this->menu['parent'] += array(
    'type' => 'none',
    'title' => '',
    'weight' => 0,
    'name' => 'main-menu',
  );

  // Load conditions.
  foreach ($this->conditions as $key => $condition) {
    $this->conditions[$key] = layout_create_handler('layout_access', $condition['plugin'], $condition['data']);
  }
}