You are here

public function Step::formModes in Forms Steps 8

Return a list of form modes available for this entity bundle.

Return value

array Returns the list of form modes.

File

src/Step.php, line 215

Class

Step
A value object representing a step state.

Namespace

Drupal\forms_steps

Code

public function formModes() {
  $result = [];

  // Get the list of available form modes for a certain entity type.
  $form_modes = \Drupal::service('entity_display.repository')
    ->getFormModes($this->entityType);
  foreach ($form_modes as $form_mode) {
    $result[$form_mode['id']] = $form_mode['label'];
  }
  $result['default'] = 'Default';
  return $result;
}