You are here

protected function EntitySubmenuBlock::getConfigurationValue in Entity Submenu Block 8

Returns a configuration value for a specified field.

Parameters

array $config: Array containing the configuration.

string $field: Name of the field to get a value for.

array $valid: Optional array containing valid values for the field.

Return value

value Value for the field or NULL.

2 calls to EntitySubmenuBlock::getConfigurationValue()
EntitySubmenuBlock::blockForm in src/Plugin/Block/EntitySubmenuBlock.php
EntitySubmenuBlock::build in src/Plugin/Block/EntitySubmenuBlock.php
Builds and returns the renderable array for this block plugin.

File

src/Plugin/Block/EntitySubmenuBlock.php, line 249

Class

EntitySubmenuBlock
Provides an Entity Submenu Block.

Namespace

Drupal\entity_submenu_block\Plugin\Block

Code

protected function getConfigurationValue(array $config, $field, array $valid = NULL) {
  $value = NULL;
  if (isset($config[$field]) && !empty($config[$field])) {
    if (is_array($valid)) {
      if (in_array($config[$field], $valid)) {
        $value = $config[$field];
      }
    }
    else {
      $value = $config[$field];
    }
  }
  return $value;
}