You are here

private function NodeViewCountSettingsForm::getNodeViewModesOptions in Node view count 8

Get all possible view mode names for nodes.

Data returned in format applicable for '#options' key of form element. Keys are ids of view modes, values are labels (human readable names) of view modes.

Return value

array All possible view mode names for nodes.

1 call to NodeViewCountSettingsForm::getNodeViewModesOptions()
NodeViewCountSettingsForm::buildForm in src/Form/NodeViewCountSettingsForm.php
Form constructor.

File

src/Form/NodeViewCountSettingsForm.php, line 181

Class

NodeViewCountSettingsForm
Configure nodeviewcount settings.

Namespace

Drupal\nodeviewcount\Form

Code

private function getNodeViewModesOptions() {
  $view_modes_options = [];
  $view_modes = $this->entityDisplayRepository
    ->getViewModes('node');
  foreach ($view_modes as $view_mode_id => $view_mode) {
    $view_modes_options[$view_mode_id] = $view_mode['label'];
  }
  return $view_modes_options;
}