DevelGenerate.php
Same filename in this branch
Same filename and directory in other branches
Namespace
Drupal\devel_generate\AttributeFile
-
devel_generate/
src/ Attribute/ DevelGenerate.php
View source
<?php
namespace Drupal\devel_generate\Attribute;
use Drupal\Component\Plugin\Attribute\Plugin;
use Drupal\Core\StringTranslation\TranslatableMarkup;
/**
* 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().
*
* @see \Drupal\devel_generate\DevelGeneratePluginManager
* @see \Drupal\devel_generate\DevelGenerateBaseInterface
*/
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();
}
}
Classes
| Title | Deprecated | Summary |
|---|---|---|
| DevelGenerate | Defines a DevelGenerate attribute object. |