abstract class AvatarGeneratorBase in Avatar Kit 8
AvatarGenerator plugin base class.
Hierarchy
- class \Drupal\Component\Plugin\PluginBase implements DerivativeInspectionInterface, PluginInspectionInterface
- class \Drupal\avatars\Plugin\AvatarGenerator\AvatarGeneratorBase implements AvatarGeneratorPluginInterface
Expanded class hierarchy of AvatarGeneratorBase
6 files declare their use of AvatarGeneratorBase
- Adorable.php in avatars_adorable/
src/ Plugin/ AvatarGenerator/ Adorable.php - DynamicTestGenerator.php in tests/
modules/ avatars_test/ src/ Plugin/ AvatarGenerator/ DynamicTestGenerator.php - Gravatar.php in avatars_gravatar/
src/ Plugin/ AvatarGenerator/ Gravatar.php - GravatarGenerator.php in avatars_gravatar/
src/ Plugin/ AvatarGenerator/ GravatarGenerator.php - Robohash.php in avatars_robohash/
src/ Plugin/ AvatarGenerator/ Robohash.php
File
- src/
Plugin/ AvatarGenerator/ AvatarGeneratorBase.php, line 12
Namespace
Drupal\avatars\Plugin\AvatarGeneratorView source
abstract class AvatarGeneratorBase extends PluginBase implements AvatarGeneratorPluginInterface {
/**
* {@inheritdoc}
*/
public function __construct(array $configuration, $plugin_id, $plugin_definition) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
$this->configuration = array_merge($this
->defaultConfiguration(), $this->configuration);
}
/**
* {@inheritdoc}
*/
public function defaultConfiguration() {
return [];
}
/**
* {@inheritdoc}
*/
public function getConfiguration() {
return $this->configuration;
}
/**
* {@inheritdoc}
*/
public function setConfiguration(array $configuration) {
$this->configuration = $configuration;
}
/**
* {@inheritdoc}
*/
public function calculateDependencies() {
return [];
}
/**
* {@inheritdoc}
*/
public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
return $form;
}
/**
* {@inheritdoc}
*/
public function validateConfigurationForm(array &$form, FormStateInterface $form_state) {
}
/**
* {@inheritdoc}
*/
public function submitConfigurationForm(array &$form, FormStateInterface $form_state) {
}
/**
* Create a site-unique identifier for a user.
*
* @param \Drupal\Core\Session\AccountInterface $account
* A user account.
*
* @return string
* A unique string based on the user.
*/
protected function getIdentifier(AccountInterface $account) {
// There is no ID for new users (registration page).
if ($account
->isNew()) {
return '0';
}
else {
return !empty($account
->getEmail()) ? $account
->getEmail() : (string) $account
->id();
}
}
/**
* {@inheritdoc}
*/
public function settingsSummary() {
return [];
}
/**
* {@inheritdoc}
*/
public function getFile(AccountInterface $account) {
return NULL;
}
/**
* {@inheritdoc}
*/
public function generateUri(AccountInterface $account) {
return NULL;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
AvatarGeneratorBase:: |
public | function |
Form constructor. Overrides PluginFormInterface:: |
3 |
AvatarGeneratorBase:: |
public | function |
Calculates dependencies for the configured plugin. Overrides DependentPluginInterface:: |
|
AvatarGeneratorBase:: |
public | function |
Gets default configuration for this plugin. Overrides ConfigurableInterface:: |
3 |
AvatarGeneratorBase:: |
public | function |
Creates a URI to an avatar. Overrides AvatarGeneratorPluginInterface:: |
8 |
AvatarGeneratorBase:: |
public | function |
Gets this plugin's configuration. Overrides ConfigurableInterface:: |
|
AvatarGeneratorBase:: |
public | function |
Gets File object for an avatar. Overrides AvatarGeneratorPluginInterface:: |
1 |
AvatarGeneratorBase:: |
protected | function | Create a site-unique identifier for a user. | |
AvatarGeneratorBase:: |
public | function |
Sets the configuration for this plugin instance. Overrides ConfigurableInterface:: |
|
AvatarGeneratorBase:: |
public | function |
Generate a summary about the current configuration of the widget. Overrides AvatarGeneratorPluginInterface:: |
3 |
AvatarGeneratorBase:: |
public | function |
Form submission handler. Overrides PluginFormInterface:: |
3 |
AvatarGeneratorBase:: |
public | function |
Form validation handler. Overrides PluginFormInterface:: |
|
AvatarGeneratorBase:: |
public | function |
Constructs a \Drupal\Component\Plugin\PluginBase object. Overrides PluginBase:: |
|
PluginBase:: |
protected | property | Configuration information passed into the plugin. | 1 |
PluginBase:: |
protected | property | The plugin implementation definition. | 1 |
PluginBase:: |
protected | property | The plugin_id. | |
PluginBase:: |
constant | A string which is used to separate base plugin IDs from the derivative ID. | ||
PluginBase:: |
public | function |
Gets the base_plugin_id of the plugin instance. Overrides DerivativeInspectionInterface:: |
|
PluginBase:: |
public | function |
Gets the derivative_id of the plugin instance. Overrides DerivativeInspectionInterface:: |
|
PluginBase:: |
public | function |
Gets the definition of the plugin implementation. Overrides PluginInspectionInterface:: |
3 |
PluginBase:: |
public | function |
Gets the plugin_id of the plugin instance. Overrides PluginInspectionInterface:: |
|
PluginBase:: |
public | function | Determines if the plugin is configurable. |