You are here

private function SiteSettingsLoader::getValue in Site Settings and Labels 8

Get the value for the particular field item.

Parameters

\Drupal\Core\Field\FieldItemListInterface $field: The field object.

Return value

bool|array The value or false.

1 call to SiteSettingsLoader::getValue()
SiteSettingsLoader::getValues in src/SiteSettingsLoader.php
Get the values from the entity and return in as simple an array possible.

File

src/SiteSettingsLoader.php, line 234

Class

SiteSettingsLoader
Class SiteSettingsLoader.

Namespace

Drupal\site_settings

Code

private function getValue(FieldItemListInterface $field) {
  if ($value = $field
    ->getValue()) {

    // Store the values in as flat a way as possible based on what is set.
    if (count($value) <= 1) {
      $item = reset($value);
      if (count($item) <= 1) {
        return reset($item);
      }
      else {
        return $item;
      }
    }
    else {
      return $value;
    }
  }
  return FALSE;
}