You are here

protected function GetValueCommand::execute in Config Pages 8.2

Same name and namespace in other branches
  1. 8.3 src/Command/GetValueCommand.php \Drupal\config_pages\Command\GetValueCommand::execute()

File

src/Command/GetValueCommand.php, line 70

Class

GetValueCommand
Class for a Drupal command to works with ConfigPages.

Namespace

Drupal\config_pages\Command

Code

protected function execute(InputInterface $input, OutputInterface $output) {
  $bundle = $input
    ->getArgument('bundle');
  $field_name = $input
    ->getArgument('field_name');
  $context = $input
    ->getArgument('context');
  try {
    $config_page = config_pages_config($bundle, $context);
    if (!empty($config_page)) {
      $output
        ->writeln($config_page
        ->get($field_name)->value);
    }
  } catch (\Exception $e) {
    $this->logger
      ->error($e
      ->getMessage());
  }
}