You are here

protected function YamlContentProcessBase::throwParamError in YAML Content 8

Prepare an error message and throw error.

Parameters

string $error_message: The error message to display.

string $entity_type: The entity type.

array $filter_params: The filters for the query conditions.

2 calls to YamlContentProcessBase::throwParamError()
File::process in src/Plugin/yaml_content/process/File.php
Processes field data.
Reference::process in src/Plugin/yaml_content/process/Reference.php
Processes field data.

File

src/Plugin/YamlContentProcessBase.php, line 23

Class

YamlContentProcessBase
Defines a base processor implementation that most processors will extend.

Namespace

Drupal\yaml_content\Plugin

Code

protected function throwParamError($error_message, $entity_type, array $filter_params) {

  // Build parameter output description for error message.
  $error_params = [
    '[',
    '  "entity_type" => ' . $entity_type . ',',
  ];
  foreach ($filter_params as $key => $value) {
    $error_params[] = sprintf("  '%s' => '%s',", $key, $value);
  }
  $error_params[] = ']';
  $param_output = implode("\n", $error_params);
  throw new MissingDataException(__CLASS__ . ': ' . $error_message . ': ' . $param_output);
}