You are here

function hook_consumes_list_alter in Consumers 8

Alters the list builder.

Parameters

array $data: The data to alter. It's either the header or a data row.

array $context: Contains a key 'type' that can be either 'header' or 'row'. It can also contain a key 'entity' containing the consumer entity in the row.

File

./consumers.api.php, line 22
Documentation for Consumers module APIs.

Code

function hook_consumes_list_alter(array &$data, array $context) {
  if ($context['type'] === 'header') {
    $data['scopes'] = t('Foo');
  }
  elseif ($context['type'] === 'row') {
    $entity = $context['entity'];
    $data['confidential'] = $entity
      ->get('foo')->value;
  }
}