devel_wizard-2.x-dev/src/Attribute/DevelWizardSpell.php
src/Attribute/DevelWizardSpell.php
<?php
declare(strict_types=1);
namespace Drupal\devel_wizard\Attribute;
use Drupal\Component\Plugin\Attribute\Plugin;
use Drupal\Core\StringTranslation\TranslatableMarkup;
use Drupal\devel_wizard\Spell\SpellDefinition;
#[\Attribute(\Attribute::TARGET_CLASS)]
class DevelWizardSpell extends Plugin {
/**
* @param string $id
* The attribute class ID.
* @param null|\Drupal\Core\StringTranslation\TranslatableMarkup $category
* The category of the Spell.
* @param null|\Drupal\Core\StringTranslation\TranslatableMarkup $label
* The human-readable name of the Spell.
* @param null|\Drupal\Core\StringTranslation\TranslatableMarkup $description
* The brief description of the Spell.
* @param array<string, \Drupal\Core\StringTranslation\TranslatableMarkup> $tags
* Custom tags.
* @param null|class-string<\Drupal\Component\Plugin\Derivative\DeriverInterface> $deriver
* Deriver class.
*
* @todo Maybe the "category" is not necessary.
*/
public function __construct(
public readonly string $id,
public readonly ?TranslatableMarkup $category = NULL,
public readonly ?TranslatableMarkup $label = NULL,
public readonly ?TranslatableMarkup $description = NULL,
public readonly array $tags = [],
public readonly ?string $deriver = NULL,
) {}
/**
* {@inheritdoc}
*/
public function get(): array|object {
return new SpellDefinition(parent::get());
}
}
