You are here

function supersized_get_supersized_field in Supersized 8

Same name and namespace in other branches
  1. 7 supersized.module \supersized_get_supersized_field()

Get supersized field by node.

4 calls to supersized_get_supersized_field()
supersized_context_condition::execute in supersized_context/supersized_context_condition.inc
Override execute().
supersized_node_settings_access in ./supersized.module
An access check helper function.
supersized_node_settings_form in ./supersized.module
Supersized setting form for node.
supersized_run in ./supersized.run.inc
Start supersized with Supersized plugin.

File

./supersized.module, line 415
Supersized module file.

Code

function supersized_get_supersized_field($node) {
  $fields = field_info_instances('node', $node->type);
  foreach ($fields as $field_name => $field) {

    // Supersized will only be available in full page view.
    // Assume only one supersized field in each node type.
    if ($field['display']['default']['type'] == 'supersized' || isset($field['display']['full']['type']) && $field['display']['full']['type'] == 'supersized') {
      $items = field_get_items('node', $node, $field_name);
      $instance = field_info_instance('node', $field_name, $node->type);
      return array(
        'instance' => $instance,
        'items' => $items,
      );
    }
  }
  return NULL;
}