You are here

mobile_tools_context.condition_mobile.inc in Mobile Tools 7.2

Integration with the Context module

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

File

mobile_tools_context/mobile_tools_context.condition_mobile.inc
View source
<?php

/**
 * @file
 * Integration with the Context module
 *
 * Triggers a context for a mobile device vs a desktop device
 * @todo add arbitrary group contexts?
 */
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;
  }

}

Classes

Namesort descending Description
mobile_tools_context_condition_mobile @file Integration with the Context module