You are here

public function ContentHubRequirementBase::__construct in Acquia Content Hub 8

Constructs a new ContentHubRequirementBase.

Parameters

array $configuration: A configuration array containing information about the plugin instance.

string $plugin_id: The plugin_id for the plugin instance.

mixed $plugin_definition: The plugin implementation definition.

\Drupal\Core\Extension\ModuleHandlerInterface $module_handler: The module handler.

Overrides PluginBase::__construct

File

acquia_contenthub_diagnostic/src/ContentHubRequirementBase.php, line 55

Class

ContentHubRequirementBase
Defines a base implementation that Content Hub Requirements will extend.

Namespace

Drupal\acquia_contenthub_diagnostic

Code

public function __construct(array $configuration, $plugin_id, $plugin_definition, ModuleHandlerInterface $module_handler) {
  parent::__construct($configuration, $plugin_id, $plugin_definition);
  $this->moduleHandler = $module_handler;
  try {
    $this->severity = $this
      ->verify();
  } catch (\Exception $e) {
    $this
      ->setValue($this
      ->t("An exception occurred."));
    $this
      ->setDescription($this
      ->t('Error: @error', [
      '@error' => $e
        ->getMessage(),
    ]));
    $this->severity = REQUIREMENT_ERROR;
  }
}