Project

General

Profile

Paste
Download (2.98 KB) Statistics
| Branch: | Revision:

root / drupal7 / sites / all / modules / ds / modules / ds_extras / ds_extras.ds_fields_info.inc @ bf6fb0ee

1
<?php
2

    
3
/**
4
 * @file
5
 * Display Suite extras fields.
6
 */
7

    
8
/**
9
 * Implements hook_ds_fields_info().
10
 */
11
function ds_extras_ds_fields_info($entity_type) {
12
  $fields = array();
13

    
14
  // Switch field support.
15
  if (variable_get('ds_extras_switch_field', FALSE) && $entity_type == 'node') {
16
    $fields[$entity_type]['ds_switch_field'] = array(
17
      'title' => t('Switch view mode'),
18
      'field_type' => DS_FIELD_TYPE_FUNCTION,
19
      'function' => 'ds_extras_switch_view_mode_field',
20
      'properties' => array('settings' => array()),
21
    );
22
  }
23

    
24
  // Flag support.
25
  if (variable_get('ds_extras_flag') && module_exists('flag')) {
26
    if ($entity_type == 'node') {
27
      $flags = flag_get_flags('node');
28
      foreach ($flags as $name => $flag) {
29
        $ui_limit = array();
30
        if (!empty($flag->types)) {
31
          foreach ($flag->types as $type) {
32
            $ui_limit[] = $type . '|*';
33
          }
34
        }
35
        $fields['node']['ds_flag_' . $name] = array(
36
          'title' => t('Flag: ' . $flag->get_label('title')),
37
          'field_type' => DS_FIELD_TYPE_FUNCTION,
38
          'function' => 'ds_extras_flags_add_flag_link',
39
          'properties' => array(
40
            'flag' => $name,
41
          ),
42
          'ui_limit' => $ui_limit,
43
        );
44
      }
45
    }
46
  }
47

    
48
  // DS Views.
49
  if ($entity_type == 'ds_views') {
50
    $fields[$entity_type] = array(
51
      'title' => array(
52
        'title' => t('Views title'),
53
        'field_type' => DS_FIELD_TYPE_FUNCTION,
54
        'function' => 'ds_vd_render_title_field',
55
        'properties' => array(
56
          'formatters' => array(
57
            'vd_title_h1' => t('H1 title'),
58
            'vd_title_h2' => t('H2 title'),
59
            'vd_title_p' => t('Paragraph title'),
60
          ),
61
        )
62
      ),
63
      'header' => array(
64
        'title' => t('Views header'),
65
        'field_type' => DS_FIELD_TYPE_PREPROCESS,
66
      ),
67
      'exposed' => array(
68
        'title' => t('Exposed filters'),
69
        'field_type' => DS_FIELD_TYPE_PREPROCESS,
70
      ),
71
      'attachment_before' => array(
72
        'title' => t('Attachment before'),
73
        'field_type' => DS_FIELD_TYPE_PREPROCESS,
74
      ),
75
      'rows' => array(
76
        'title' => t('Views content'),
77
        'field_type' => DS_FIELD_TYPE_PREPROCESS,
78
      ),
79
      'empty' => array(
80
        'title' => t('Empty text'),
81
        'field_type' => DS_FIELD_TYPE_PREPROCESS,
82
      ),
83
      'pager' => array(
84
        'title' => t('Pager'),
85
        'field_type' => DS_FIELD_TYPE_PREPROCESS,
86
      ),
87
      'attachment_after' => array(
88
        'title' => t('Attachment after'),
89
        'field_type' => DS_FIELD_TYPE_PREPROCESS,
90
      ),
91
      'more' => array(
92
        'title' => t('More'),
93
        'field_type' => DS_FIELD_TYPE_PREPROCESS,
94
      ),
95
      'footer' => array(
96
        'title' => t('Views footer'),
97
        'field_type' => DS_FIELD_TYPE_PREPROCESS,
98
      ),
99
      'feed_icon' => array(
100
        'title' => t('Feed icon'),
101
        'field_type' => DS_FIELD_TYPE_PREPROCESS,
102
      ),
103
    );
104
  }
105

    
106
  if (!empty($fields)) {
107
    return $fields;
108
  }
109
}