mapSingleFieldViewsData example

$field_definition_type = $field_definition->getType();
    // Add all properties to views table data. We need an entry for each     // column of each field, with the first one given special treatment.     // @todo Introduce concept of the "main" column for a field, rather than     // assuming the first one is the main column. See also what the     // mapSingleFieldViewsData() method does with $first.     $first = TRUE;
    foreach ($field_column_mapping as $field_column_name => $schema_field_name) {
      // The fields might be defined before the actual table.       $table_data = $table_data ?: [];
      $table_data += [$schema_field_name => []];
      $table_data[$schema_field_name] = NestedArray::mergeDeep($table_data[$schema_field_name]$this->mapSingleFieldViewsData($table$field_name$field_definition_type$field_column_name$field_schema['columns'][$field_column_name]['type']$first$field_definition));
      $table_data[$schema_field_name]['entity field'] = $field_name;
      $first = FALSE;
    }
  }

  /** * Provides the views data for a given data type and schema field. * * @param string $table * The table of the field to handle. * @param string $field_name * The machine name of the field being processed. * @param string $field_type * The type of field being handled. * @param string $column_name * For fields containing multiple columns, the column name being processed. * @param string $column_type * Within the field, the column type being handled. * @param bool $first * TRUE if this is the first column within the field. * @param \Drupal\Core\Field\FieldDefinitionInterface $field_definition * The field definition. * * @return array * The modified views data field definition. */
Home | Imprint | This part of the site doesn't use cookies.