PasswordConstraintBase.php in Password Policy 8.3
File
src/PasswordConstraintBase.php
View source
<?php
namespace Drupal\password_policy;
use Drupal\Component\Plugin\PluginBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\StringTranslation\StringTranslationTrait;
abstract class PasswordConstraintBase extends PluginBase implements PasswordConstraintInterface {
use StringTranslationTrait;
public function __construct(array $configuration, $plugin_id, $plugin_definition) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
$this
->setConfiguration($configuration);
}
public function getTitle() {
return $this->pluginDefinition['title'];
}
public function getDescription() {
return $this->pluginDefinition['description'];
}
public function getErrorMessage() {
return $this->pluginDefinition['errorMessage'];
}
public function validateConfigurationForm(array &$form, FormStateInterface $form_state) {
}
public function defaultConfiguration() {
return [];
}
public function getConfiguration() {
return [
'id' => $this
->getPluginId(),
] + $this->configuration;
}
public function setConfiguration(array $configuration) {
$this->configuration = $configuration + $this
->defaultConfiguration();
return $this;
}
public function calculateDependencies() {
return [];
}
}