You are here

protected function FieldBlock::getFieldOptions in Field as Block 8.2

Returns field options.

Return value

array Array of field option names keyed by their machine name.

1 call to FieldBlock::getFieldOptions()
FieldBlock::blockForm in src/Plugin/Block/FieldBlock.php

File

src/Plugin/Block/FieldBlock.php, line 137

Class

FieldBlock
Provides a fieldblock.

Namespace

Drupal\fieldblock\Plugin\Block

Code

protected function getFieldOptions() {
  $field_definitions = $this->entityFieldManager
    ->getFieldStorageDefinitions($this
    ->getDerivativeId());
  $options = [];
  foreach ($field_definitions as $definition) {
    $options[$definition
      ->getName()] = $definition
      ->getLabel();
  }
  return $options;
}