function context_reaction_menu::options_form

cis7 context_reaction_menu.inc context_reaction_menu::options_form($context)
cle7 context_reaction_menu.inc context_reaction_menu::options_form($context)
elmsmedia7 context_reaction_menu.inc context_reaction_menu::options_form($context)
icor7 context_reaction_menu.inc context_reaction_menu::options_form($context)
meedjum_blog7 context_reaction_menu.inc context_reaction_menu::options_form($context)
mooc7 context_reaction_menu.inc context_reaction_menu::options_form($context)

Provide a form element that allow the admin to chose a menu item.

Overrides context_reaction::options_form

File

sites/all/modules/ulmus/context/plugins/context_reaction_menu.inc, line 10

Class

context_reaction_menu
Expose menu items as context reactions.

Code

function options_form($context) {
  if (module_exists('menu')) {
    $menus = menu_parent_options(menu_get_menus(), array('mlid' => 0));
    $root_menus = array();
    foreach ($menus as $key => $name) {
      $id = explode(':', $key);
      if ($id[1] == '0') {
        $root_menus[$id[0]] = check_plain($name);
      }
      else {
        $link = menu_link_load($id[1]);
        $identifier = $link['link_path'];
        $root_menu = $root_menus[$id[0]];
        while (isset($menus[$root_menu][$identifier])) {
          $identifier .= "'";
        }
        $menus[$root_menu][$identifier] = $name;
      }
      unset($menus[$key]);
    }
    array_unshift($menus, "-- " . t('None') . " --");
  }
  else {
    $menus = array();
  }
  return array(
    '#title' => $this->title,
    '#description' => $this->description,
    '#options' => $menus,
    '#type' => 'select',
    '#default_value' => $this->fetch_from_context($context),
  );
}
Error | ELMSLN API

Error

×

Error message

  • Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/elmsln_community/api.elmsln.org/includes/common.inc:2791) in drupal_send_headers() (line 1499 of /var/www/html/elmsln_community/api.elmsln.org/includes/bootstrap.inc).
  • Error: Call to undefined function apc_delete() in DrupalAPCCache->clear() (line 289 of /var/www/html/elmsln_community/api.elmsln.org/sites/all/modules/apc/drupal_apc_cache.inc).
The website encountered an unexpected error. Please try again later.