You are here

function footnotes_field_ds_fields_info in Footnotes 7.2

Same name and namespace in other branches
  1. 7.3 footnotes_field/footnotes_field.module \footnotes_field_ds_fields_info()

Implements hook_ds_fields_info().

File

footnotes_field/footnotes_field.module, line 48
Hooks and general logic for the Footnotes field module.

Code

function footnotes_field_ds_fields_info($entity_type) {
  $fields = array();
  $settings = _footnotes_field_get_settings();
  if (!empty($settings['content_types'])) {
    $content_types = array_keys(array_filter($settings['content_types']));

    // Only expose this field if there is at least one content type selected.
    if (!empty($content_types)) {
      $ui_limit = array();
      foreach ($content_types as $content_type) {
        $ui_limit[] = $content_type . '|*';
      }
      $fields['footnotes_field'] = array(
        'title' => t('Footnotes (ds field)'),
        'field_type' => DS_FIELD_TYPE_FUNCTION,
        'ui_limit' => $ui_limit,
        'file' => drupal_get_path('module', 'footnotes_field') . '/ds/ds_footnotes_ui_field.inc',
        'function' => '_footnotes_field_render',
        'properties' => array(),
      );
      return array(
        'node' => $fields,
      );
    }
  }
}