You are here

function range_field_views_data_argument in Range 8

Provides range views argument data.

Parameters

array $data: Views data array.

\Drupal\field\FieldStorageConfigInterface $field_storage: The field storage config entity.

1 call to range_field_views_data_argument()
range_field_views_data in ./range.views.inc
Implements hook_field_views_data().

File

./range.views.inc, line 108
Provides views data for the range module.

Code

function range_field_views_data_argument(array &$data, FieldStorageConfigInterface $field_storage) {
  list($label, $data_table_name, $revision_table_name, $additional_fields) = range_field_views_data_base($field_storage);
  $field_name = $field_storage
    ->getName();
  $base = [
    'help' => t('Range contains (or does not contain) a value'),
    'id' => 'range',
    'field_name' => $field_name,
    'entity_type' => $field_storage
      ->getTargetEntityTypeId(),
    'empty field name' => t('- No value -'),
    'additional fields' => $additional_fields,
    // Temporarily make argument of a string type,
    // until https://www.drupal.org/node/2799201 and
    // https://www.drupal.org/node/2595025 end up in core.
    'numeric' => FALSE,
    'break_phrase' => FALSE,
  ];
  $data[$data_table_name][$field_name]['argument'] = [
    'title' => t('@label range argument', [
      '@label' => $label,
    ]),
    'table' => $data_table_name,
  ] + $base;
  if ($revision_table_name) {
    $data[$revision_table_name]["{$field_name}-revision_id"]['argument'] = [
      'title' => t('@label range argument (historical data)', [
        '@label' => $label,
      ]),
      'table' => $revision_table_name,
    ] + $base;
  }
}