You are here

function hook_datalayer_field_alter in dataLayer 8

Alter the Data Layer field values before output.

Parameters

array $value: Value for the field item being added to the datalayer.

\Drupal\Core\Field\FieldItemInterface $field_item: Individual field item the value is from.

string $field_type: Type of field, such as 'string' or 'entity_refernce'.

Related topics

1 invocation of hook_datalayer_field_alter()
_datalayer_field_get_value in ./datalayer.module
Get an array of values from a field object.

File

./datalayer.api.php, line 91
Documentation for the Data Layer module.

Code

function hook_datalayer_field_alter(array &$value, \Drupal\Core\Field\FieldItemInterface $field_item, $field_type) {

  // EXAMPLE:
  // Remove the filter format for a text with summary field.
  if ($field_type == 'text_with_summary') {
    unset($value['format']);
  }
}