class DevelGenerate
Same name in this branch
- 5.x devel_generate/src/Annotation/DevelGenerate.php \Drupal\devel_generate\Annotation\DevelGenerate
Same name and namespace in other branches
- 4.x devel_generate/src/Annotation/DevelGenerate.php \Drupal\devel_generate\Annotation\DevelGenerate
Defines a DevelGenerate attribute object.
DevelGenerate handle the bulk creation of entites.
Additional definition keys for DevelGenerate can be defined in hook_devel_generate_info_alter().
Attributes
#[\Attribute(\Attribute::TARGET_CLASS)]
Hierarchy
- class \Drupal\Component\Plugin\Attribute\AttributeBase implements \Drupal\Component\Plugin\Attribute\AttributeInterface
- class \Drupal\Component\Plugin\Attribute\Plugin extends \Drupal\Component\Plugin\Attribute\AttributeBase
- class \Drupal\devel_generate\Attribute\DevelGenerate extends \Drupal\Component\Plugin\Attribute\Plugin
- class \Drupal\Component\Plugin\Attribute\Plugin extends \Drupal\Component\Plugin\Attribute\AttributeBase
Expanded class hierarchy of DevelGenerate
See also
\Drupal\devel_generate\DevelGeneratePluginManager
\Drupal\devel_generate\DevelGenerateBaseInterface
9 files declare their use of DevelGenerate
- BlockContentDevelGenerate.php in devel_generate/
src/ Plugin/ DevelGenerate/ BlockContentDevelGenerate.php - ContentDevelGenerate.php in devel_generate/
src/ Plugin/ DevelGenerate/ ContentDevelGenerate.php - DevelGeneratePluginManager.php in devel_generate/
src/ DevelGeneratePluginManager.php - ExampleDevelGenerate.php in devel_generate/
tests/ modules/ devel_generate_example/ src/ Plugin/ DevelGenerate/ ExampleDevelGenerate.php - MediaDevelGenerate.php in devel_generate/
src/ Plugin/ DevelGenerate/ MediaDevelGenerate.php
File
-
devel_generate/
src/ Attribute/ DevelGenerate.php, line 19
Namespace
Drupal\devel_generate\AttributeView source
class DevelGenerate extends Plugin {
/**
* Modules that should be enabled in order to make the plugin discoverable.
*
* @var string[]
*/
private readonly array $moduleDependencies;
/**
* Constructs a DevelGenerate attribute.
*
* @param string $id
* The plugin ID.
* @param \Drupal\Core\StringTranslation\TranslatableMarkup|string $label
* The human-readable name of the DevelGenerate type.
* @param \Drupal\Core\StringTranslation\TranslatableMarkup|string $description
* A short description of the DevelGenerate type.
* @param string $url
* A url to access the plugin settings form.
* @param string $permission
* The permission required to access the plugin settings form.
* @param array $settings
* (optional) An array of settings passed to the DevelGenerate settingsForm.
* The keys are the names of the settings and the values are the default
* values for those settings.
* @param string[] $dependencies
* (optional) Modules that should be enabled in order to make the plugin
* discoverable.
* @param class-string|null $deriver
* (optional) The deriver class.
*/
public function __construct(public readonly string $id, public readonly TranslatableMarkup|string $label, public readonly TranslatableMarkup|string $description, public readonly string $url, public readonly string $permission, public readonly array $settings = [], array $dependencies = [], public readonly ?string $deriver = NULL) {
$this->moduleDependencies = $dependencies;
}
/**
* {@inheritdoc}
*/
public function get() : array|object {
// Core uses the 'dependencies' property for the class dependencies of the
// plugin. Keep the definition identical to the one built from the
// annotation, where 'dependencies' is the list of required modules.
return [
'dependencies' => $this->moduleDependencies,
] + parent::get();
}
}
Members
| Title Sort descending | Modifiers | Object type | Summary | Overriden Title | Overrides |
|---|---|---|---|---|---|
| AttributeBase::$class | protected | property | The class used for this attribute class. | ||
| AttributeBase::$provider | protected | property | The provider of the attribute class. | ||
| AttributeBase::getClass | public | function | Gets the class of the attribute class. | Overrides AttributeInterface::getClass | 1 |
| AttributeBase::getId | public | function | Gets the unique ID for this attribute class. | Overrides AttributeInterface::getId | |
| AttributeBase::getProvider | public | function | Gets the name of the provider of the attribute class. | Overrides AttributeInterface::getProvider | |
| AttributeBase::setClass | public | function | Sets the class of the attributed class. | Overrides AttributeInterface::setClass | 1 |
| AttributeBase::setProvider | public | function | Sets the name of the provider of the attribute class. | Overrides AttributeInterface::setProvider | |
| DevelGenerate::$moduleDependencies | private | property | Modules that should be enabled in order to make the plugin discoverable. | ||
| DevelGenerate::get | public | function | Gets the value of an attribute. | Overrides AttributeBase::get | |
| DevelGenerate::__construct | public | function | Constructs a DevelGenerate attribute. | Overrides Plugin::__construct |