function context_condition_node_taxonomy::execute

cis7 context_condition_node_taxonomy.inc context_condition_node_taxonomy::execute($node, $op)
cle7 context_condition_node_taxonomy.inc context_condition_node_taxonomy::execute($node, $op)
elmsmedia7 context_condition_node_taxonomy.inc context_condition_node_taxonomy::execute($node, $op)
icor7 context_condition_node_taxonomy.inc context_condition_node_taxonomy::execute($node, $op)
meedjum_blog7 context_condition_node_taxonomy.inc context_condition_node_taxonomy::execute($node, $op)
mooc7 context_condition_node_taxonomy.inc context_condition_node_taxonomy::execute($node, $op)

Overrides context_condition_node::execute

File

sites/all/modules/ulmus/context/plugins/context_condition_node_taxonomy.inc, line 41

Class

context_condition_node_taxonomy
Expose node taxonomy terms as a context condition.

Code

function execute($node, $op) {
  // build a list of each taxonomy reference field belonging to the bundle for the current node
  $fields = field_info_fields();
  $instance_fields = field_info_instances('node', $node->type);
  $check_fields = array();
  foreach ($instance_fields as $key => $field_info) {
    if ($fields[$key]['type'] == 'taxonomy_term_reference') {
      $check_fields[] = $key;
    }
  }

  if ($this->condition_used() && !empty($check_fields)) {
    foreach ($check_fields as $field) {
      if ($terms = field_get_items('node', $node, $field)) {
        foreach ($terms as $term) {
          foreach ($this->get_contexts($term['tid']) as $context) {
            // Check the node form option.
            if ($op === 'form') {
              $options = $this->fetch_from_context($context, 'options');
              if (!empty($options['node_form'])) {
                $this->condition_met($context, $term['tid']);
              }
            }
            else {
              $this->condition_met($context, $term['tid']);
            }
          }
        }
      }
    }
  }
}
Error | ELMSLN API

Error

×

Error message

  • Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/elmsln_community/api.elmsln.org/includes/common.inc:2791) in drupal_send_headers() (line 1499 of /var/www/html/elmsln_community/api.elmsln.org/includes/bootstrap.inc).
  • Error: Call to undefined function apc_delete() in DrupalAPCCache->clear() (line 289 of /var/www/html/elmsln_community/api.elmsln.org/sites/all/modules/apc/drupal_apc_cache.inc).
The website encountered an unexpected error. Please try again later.