You are here

class i18n_menu_node_context_condition in Menu translation - Node 7

Expose translated node menu items as a context condition.

Hierarchy

Expanded class hierarchy of i18n_menu_node_context_condition

2 string references to 'i18n_menu_node_context_condition'
i18n_menu_node_context_plugins in ./i18n_menu_node.module
Implementation of hook_context_plugins().
i18n_menu_node_context_registry_alter in ./i18n_menu_node.module
Implementation of hook_context_registry().

File

plugins/i18n_menu_node_context_condition.inc, line 6

View source
class i18n_menu_node_context_condition extends context_condition_menu {

  /**
   * Override of execute().
   */
  function execute() {

    // Getting the current active trail may trigger a menu tree rendering.
    i18n_select(FALSE);

    // Execute the 'plain' menu condition. This will work for the source nodes.
    parent::execute();
    $trail = menu_get_active_trail();
    foreach ($trail as $item) {

      // If we do not have a matching context we try with the node translations:
      // $item['link_path'] holds the source node path, which can be checked
      // against the condition map successfully. If it is equal to $item['href']
      // we skip the item as it has been already checked before.
      if (isset($item['link_path'])) {
        $value = $item['link_path'];
        if (empty($this->values[$value]) && $item['href'] != $value && i18n_menu_node_enabled($item)) {
          foreach ($this
            ->get_contexts($value) as $context) {
            $this
              ->condition_met($context, $value);
          }
        }
      }
    }

    // Restore language selection mode.
    i18n_select(TRUE);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
context_condition::$description property
context_condition::$plugin property
context_condition::$title property
context_condition::$values property
context_condition::condition_met function Marks a context as having met this particular condition.
context_condition::condition_used function Check whether this condition is used by any contexts. Can be used to prevent expensive condition checks from being triggered when no contexts use this condition.
context_condition::editor_form function Context editor form for conditions. 2
context_condition::editor_form_submit function Context editor form submit handler.
context_condition::fetch_from_context function Retrieve options from the context provided.
context_condition::get_contexts function Retrieve all contexts with the condition value provided. 2
context_condition::options_form function Options form. Provide additional options for your condition. 4
context_condition::options_form_submit function Options form submit handler.
context_condition::settings_form function Settings form. Provide variable settings for your condition.
context_condition::__clone function Clone our references when we're being cloned.
context_condition::__construct function Constructor. Do not override.
context_condition_menu::condition_form function Override of condition_form(). Use multiselect widget. Overrides context_condition::condition_form
context_condition_menu::condition_form_submit function Override of condition_form_submit(). Trim any identifier padding for non-unique path menu items. Overrides context_condition::condition_form_submit
context_condition_menu::condition_values function Override of condition_values(). Overrides context_condition::condition_values
i18n_menu_node_context_condition::execute function Override of execute(). Overrides context_condition_menu::execute