You are here

function hook_ds_custom_fields_info in Display Suite 7.2

Same name and namespace in other branches
  1. 7 ds.api.php \hook_ds_custom_fields_info()

Define custom fields which can be overridden through the UI and which are exportable. The keys are almost the same as in hook_ds_fields_info() except that field_type is limited and you need an entities key.

This hook is called by CTools. For this hook to work, you need hook_ctools_plugin_api(). The values of this hook can be overridden and reverted through the UI.

1 function implements hook_ds_custom_fields_info()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

ds_exportables_test_ds_custom_fields_info in tests/ds_exportables_test/ds_exportables_test.module
Implements hook_ds_custom_fields_info().

File

./ds.api.php, line 225
Hooks provided by Display Suite module.

Code

function hook_ds_custom_fields_info() {
  $ds_fields = array();
  $ds_field = new stdClass();
  $ds_field->api_version = 1;
  $ds_field->field = 'custom_field';
  $ds_field->label = 'Custom field';

  // Field type: either block or code
  // DS_FIELD_TYPE_CODE: 5
  // DS_FIELD_TYPE_BLOCK: 6
  $ds_field->field_type = 5;

  // Collection of entities on which this custom field can work on.
  $ds_field->entities = array(
    'node' => 'node',
  );
  $ds_field->properties = array(
    'code' => array(
      'value' => '<?php print "this is a custom field"; ?>',
      'format' => 'ds_code',
    ),
    'use_token' => 0,
  );
  $ds_fields['custom_field'] = $ds_field;
  return $ds_fields;
}