You are here

private function DibaCarousel::getFields in Diba carousel slider 8

Get fields grouped by node type list.

2 calls to DibaCarousel::getFields()
DibaCarousel::blockForm in src/Plugin/Block/DibaCarousel.php
DibaCarousel::getFieldsByType in src/Plugin/Block/DibaCarousel.php
Get fields filtered by type.

File

src/Plugin/Block/DibaCarousel.php, line 603

Class

DibaCarousel
Provides a Diba carousel Block.

Namespace

Drupal\diba_carousel\Plugin\Block

Code

private function getFields($entity_type = 'node', $grouped = TRUE) {
  $fields = $this->entityFieldManager
    ->getFieldStorageDefinitions($entity_type);
  $options = [];
  foreach ($fields as $field) {
    $label = $field
      ->getLabel();
    $name = $field
      ->getName();
    $type = $field
      ->getType();
    if ($grouped) {
      $options[$type][$name] = $label . ' (' . $name . ')';
    }
    else {
      $options[$name] = $label . ' (' . $name . ')';
    }
  }
  return $options;
}