W3cubDocs

/Drupal 8

public function BaseFieldDefinition::getColumns

public BaseFieldDefinition::getColumns()

Returns the field columns, as defined in the field schema.

Return value

array[] The array of field columns, keyed by column name, in the same format returned by getSchema().

Overrides FieldStorageDefinitionInterface::getColumns

See also

\Drupal\Core\Field\FieldStorageDefinitionInterface::getSchema()

File

core/lib/Drupal/Core/Field/BaseFieldDefinition.php, line 656

Class

BaseFieldDefinition
A class for defining entity fields.

Namespace

Drupal\Core\Field

Code

public function getColumns() {
  $schema = $this->getSchema();
  // A typical use case for the method is to iterate on the columns, while
  // some other use cases rely on identifying the first column with the key()
  // function. Since the schema is persisted in the Field object, we take care
  // of resetting the array pointer so that the former does not interfere with
  // the latter.
  reset($schema['columns']);
  return $schema['columns'];
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Field!BaseFieldDefinition.php/function/BaseFieldDefinition::getColumns/8.1.x