You are here

function fico_field_options in Field Formatter Condition 8

Gets all Field Formatter Condition options.

Parameters

object $field_definition: The field definition object.

Return value

array List of conditions.

1 call to fico_field_options()
fico_condition_settings_form in ./fico.module
Field template settings form.

File

./fico.module, line 385
Contains fico.module.

Code

function fico_field_options($field_definition = NULL) {
  $options = array();
  foreach (\Drupal::service('plugin.manager.field_formatter_condition')
    ->getDefinitions() as $plugin_id => $plugin) {
    if (is_object($field_definition) && in_array($field_definition
      ->getType(), $plugin['types']) || in_array('all', $plugin['types']) || is_array($field_definition) && $field_definition['field_type'] == '_ds' && $plugin['dsFields'] == TRUE) {
      $options[$plugin_id] = $plugin['label'];
    }
  }
  return $options;
}