You are here

function context_reaction_menu::fetch_from_context in Context 7.3

Overrides parent function to include legacy handling for old format of just storing a single path.

Overrides context_reaction::fetch_from_context

2 calls to context_reaction_menu::fetch_from_context()
context_reaction_menu::get_active_paths in plugins/context_reaction_menu.inc
Helper function to return the list of currently active paths.
context_reaction_menu::options_form in plugins/context_reaction_menu.inc
Provide a form element that allow the admin to chose a menu item.

File

plugins/context_reaction_menu.inc, line 60

Class

context_reaction_menu
Expose menu items as context reactions.

Code

function fetch_from_context($context) {
  $values = parent::fetch_from_context($context);

  // Legacy - convert single string value to an array with a preferred menu
  if (is_string($values)) {
    $menu = menu_link_get_preferred($values);
    if (!$menu) {
      return array();
    }
    return array(
      $menu['menu_name'] . ':' . $menu['link_path'],
    );
  }
  return $values;
}