You are here

function ffc_condition_form_hide_source in Field formatter conditions 7

Implements ffc_condition_form_CONDITION().

Present the condition form. This is an automatically generated function callback where CONDITION is the key you return in hook_ffc_conditions_info.

This function can be put in a separate file called MODULE.ffc_conditions.inc as the conditions are loaded only when configuring. In case you need helper files for the form, you can also put them in there. The ffc module also has a couple of helper functions that are available there.

Parameters

$context: A collection with the following keys:

  • settings: all display settings, if any.
  • entity_type: The name of the entity type.
  • bundle: The name of the bundle.
  • view_mode: the name of the view mode.
  • field_name: the name of the field.
  • ds_layout: whether a Display Suite layout is configured.
  • ds_field: whether this is a Display Suite field.

$configuration: A collection of the current configuration for this condition.

Return value

A Form API definition.

File

./ffc.api.php, line 66
Hooks provided by Field formatter conditions.

Code

function ffc_condition_form_hide_source($context, $configuration) {
  $form = array();
  $form['condition'] = array(
    '#type' => 'select',
    '#title' => t('Select an option'),
    '#options' => array(
      '0' => 'Option 1',
      '1' => 'Options 2',
    ),
    '#default_value' => isset($configuration['target']) ? $configuration['target'] : '',
  );
  return $form;
}