You are here

private function ViewsFieldTemplate::getTableDefaultField in Calendar 8

Return the default field from a View table array.

Parameters

array $table_data:

mixed $entity_type_id:

Return value

null|string

2 calls to ViewsFieldTemplate::getTableDefaultField()
ViewsFieldTemplate::getDerivativeDefinitions in src/Plugin/Derivative/ViewsFieldTemplate.php
Gets the definition of all derivatives of a base plugin.
ViewsFieldTemplate::setConfigurableFieldsDerivatives in src/Plugin/Derivative/ViewsFieldTemplate.php
Set all derivatives for an entity type.

File

src/Plugin/Derivative/ViewsFieldTemplate.php, line 251

Class

ViewsFieldTemplate
Derivative class to find all field and properties for calendar View Builders.

Namespace

Drupal\calendar\Plugin\Derivative

Code

private function getTableDefaultField(array $table_data, $entity_type_id = NULL) {
  $default_field_id = NULL;
  if (!empty($table_data['table']['base']['defaults']['field'])) {
    $default_field_id = $table_data['table']['base']['defaults']['field'];
  }
  if (empty($default_field_id) && $entity_type_id) {

    // @todo Why doesn't user have a default field? Is there another way to get it?
    if ($entity_type_id == 'user') {
      $default_field_id = 'name';
    }
  }
  return $default_field_id;
}