You are here

protected function NodeFormBlock::getFormModes in Form Block 2.0.x

Get an array of node form modes.

Return value

array An array of form modes keyed by machine name.

1 call to NodeFormBlock::getFormModes()
NodeFormBlock::blockForm in src/Plugin/Block/NodeFormBlock.php
Overrides \Drupal\block\BlockBase::blockForm().

File

src/Plugin/Block/NodeFormBlock.php, line 154

Class

NodeFormBlock
Provides a block for node forms.

Namespace

Drupal\formblock\Plugin\Block

Code

protected function getFormModes() {
  $options = [
    'default' => $this
      ->t('Default'),
  ];
  foreach ($this->entityDisplayRepository
    ->getFormModes('node') as $index => $mode) {
    $options[$index] = $mode['label'];
  }
  return $options;
}