You are here

class mobile_tools_context_condition_mobile in Mobile Tools 7.2

Same name and namespace in other branches
  1. 6.3 plugins/mobile_tools_context_condition_mobile.inc \mobile_tools_context_condition_mobile
  2. 6.2 plugins/mobile_tools_context_condition_mobile.inc \mobile_tools_context_condition_mobile

@file Integration with the Context module

Triggers a context for a mobile device vs a desktop device @todo add arbitrary group contexts?

Hierarchy

Expanded class hierarchy of mobile_tools_context_condition_mobile

2 string references to 'mobile_tools_context_condition_mobile'
mobile_tools_context_context_plugins in mobile_tools_context/mobile_tools_context.module
Implementation of hook_context_plugins().
mobile_tools_context_context_registry in mobile_tools_context/mobile_tools_context.module
Implements hook_context_registry().

File

mobile_tools_context/mobile_tools_context.condition_mobile.inc, line 9
Integration with the Context module

View source
class mobile_tools_context_condition_mobile extends context_condition {

  /**
   * Default values
   */
  function condition_values() {
    return array();
  }

  /**
   * Process condition logic
   */
  function execute() {

    // Get active device group
    $active = mobile_tools_get_active_device_group();

    // Trigger the context condition based on the active device group
    // @todo
  }

  /**
   * Configuration form
   */
  function condition_form($context) {
    $form = parent::condition_form($context);
    $form['#type'] = 'checkboxes';
    $form['#description'] = t('Trigger this context when the given device groups are active.');
    $form['#options'] = mobile_tools_device_groups();
    $form['#default_value'] = $this
      ->fetch_from_context($context, 'values');
    return $form;
  }

  /**
   * Form submit handler
   */
  function condition_form_submit($values) {

    // @todo

    //dpm($values);
    return $values;
  }

}

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.
mobile_tools_context_condition_mobile::condition_form function Configuration form Overrides context_condition::condition_form
mobile_tools_context_condition_mobile::condition_form_submit function Form submit handler Overrides context_condition::condition_form_submit
mobile_tools_context_condition_mobile::condition_values function Default values Overrides context_condition::condition_values
mobile_tools_context_condition_mobile::execute function Process condition logic