You are here

function spaces_ui_context_define in Spaces 5

Same name and namespace in other branches
  1. 5.2 spaces_ui.module \spaces_ui_context_define()

Implementation of hook_context_define().

File

./spaces_ui.module, line 26

Code

function spaces_ui_context_define() {
  $items = array();
  $result = db_query('SELECT feature, label, description FROM {spaces_features_ui}');
  while ($row = db_fetch_array($result)) {
    $c = new StdClass();
    $c->namespace = 'spaces';
    $c->attribute = 'feature';
    $c->value = $row['feature'];
    if ($c = context_ui_context('load', $c)) {
      $c->spaces = $row;

      // A small change in context_ui now allows modules to
      // set system/status explicitly -- not recommended except for
      // cases like this.
      $c->system = 0;
      $c->status = 1;
      if (count($c->node)) {
        $c->spaces['options'] = _spaces_group_options();
      }
      else {

        // For now we will use enabled/disabled options
        $c->spaces['options'] = array(
          0 => t('Disabled'),
          1 => t('Enabled'),
        );
      }
      $items[] = (array) $c;
    }
  }
  return $items;
}