You are here

function ds_extras_field_extra_fields in Display Suite 7.2

Same name and namespace in other branches
  1. 7 modules/ds_extras/ds_extras.module \ds_extras_field_extra_fields()

Implements hook_field_extra_fields().

File

modules/ds_extras/ds_extras.module, line 541
Display Suite extras main functions.

Code

function ds_extras_field_extra_fields() {
  $extra = array();

  // Register a single field so fields for vd are
  // picked up nicely in the display overview form.
  if (variable_get('ds_extras_vd')) {
    ctools_include('export');
    $vd_settings = ctools_export_crud_load_all('ds_vd');
    foreach ($vd_settings as $vd) {
      $extra['ds_views'][$vd->vd] = array(
        'display' => array(
          'title' => array(
            'label' => t('Title'),
            'description' => t('Title'),
            'weight' => 10,
          ),
        ),
      );
    }
  }
  if (variable_get('ds_extras_fields_extra')) {
    $fields = explode("\n", variable_get('ds_extras_fields_extra_list', FALSE));
    foreach ($fields as $field) {
      $field = trim($field);
      if (!empty($field)) {
        list($entity, $bundle, $field_name) = explode('|', $field);
        $extra[check_plain($entity)][check_plain($bundle)]['display'][$field_name] = array(
          'label' => drupal_ucfirst(str_replace('_', ' ', check_plain($field_name))),
          'description' => drupal_ucfirst(str_replace('_', ' ', check_plain($field_name))),
          'weight' => 0,
        );
      }
    }
  }
  return $extra;
}