devel_wizard-2.x-dev/src/Commands/TaxonomyVocabularySpellCommands.php

src/Commands/TaxonomyVocabularySpellCommands.php
<?php

declare(strict_types=1);

namespace Drupal\devel_wizard\Commands;

class TaxonomyVocabularySpellCommands extends SpellCommandsBase {

  /**
   * Generates Behat tests for an existing Taxonomy Vocabulary.
   *
   * @param string $taxonomyVocabularyId
   *   The machine-name of the Taxonomy Vocabulary.
   *
   * @command devel-wizard:spell:devel_wizard_taxonomy_vocabulary_behat
   * @aliases dw:s:tv:behat
   * @bootstrap full
   *
   * @noinspection PhpUnusedParameterInspection
   */
  public function cmdBehatExecute(string $taxonomyVocabularyId): void {
    $this->execute();
  }

  /**
   * Creates a new Taxonomy Vocabulary without any extra.
   *
   * @param string $taxonomyVocabularyId
   *   The machine-name of the new Taxonomy Vocabulary.
   *
   * @command devel-wizard:spell:devel_wizard_taxonomy_vocabulary_create
   * @aliases dw:s:tv:create
   * @bootstrap full
   *
   * @noinspection PhpUnusedParameterInspection
   */
  public function cmdCreateExecute(string $taxonomyVocabularyId): void {
    $this->execute();
  }

  /**
   * Creates migration definitions and data sources for an existing Taxonomy Vocabulary.
   *
   * @param string $taxonomyVocabularyId
   *   The machine-name of the Taxonomy Vocabulary.
   *
   * @command devel-wizard:spell:devel_wizard_taxonomy_vocabulary_migration
   * @aliases dw:s:tv:migration
   * @bootstrap full
   *
   * @noinspection PhpUnusedParameterInspection
   */
  public function cmdMigrationExecute(string $taxonomyVocabularyId): void {
    $this->execute();
  }

  /**
   * Creates a new user role which grants full control over a specific Taxonomy Vocabulary.
   *
   * @param string $taxonomyVocabularyId
   *   The machine-name of the Taxonomy Vocabulary.
   *
   * @command devel-wizard:spell:devel_wizard_taxonomy_vocabulary_user_role
   * @aliases dw:s:tv:user_role
   * @bootstrap full
   *
   * @noinspection PhpUnusedParameterInspection
   */
  public function cmdUserRoleExecute(string $taxonomyVocabularyId): void {
    $this->execute();
  }

  /**
   * Creates a Taxonomy Vocabulary with all the bells and whistles.
   *
   * @param string $taxonomyVocabularyId
   *   The machine-name of the Taxonomy Vocabulary.
   *
   * @command devel-wizard:spell:devel_wizard_taxonomy_vocabulary
   * @aliases dw:s:nt
   * @bootstrap full
   *
   * @noinspection PhpUnusedParameterInspection
   */
  public function cmdAllInOneExecute(string $taxonomyVocabularyId): void {
    $this->execute();
  }

  protected function buildSpellConfigurationFromInput(): array {
    $input = $this->input();
    $spellId = $this->getSpellIdFromInput();

    return match ($spellId) {
      'devel_wizard_taxonomy_vocabulary_behat',
      'devel_wizard_taxonomy_vocabulary_migration',
      'devel_wizard_taxonomy_vocabulary_user_role' => [
        'machine_name' => $input->getArgument('taxonomyVocabularyId'),
      ],
      'devel_wizard_taxonomy_vocabulary_create' => [
        'values' => [
          'vid' => $input->getArgument('taxonomyVocabularyId'),
        ],
      ],
      'devel_wizard_taxonomy_vocabulary' => [
        'create' => [
          'values' => [
            'vid' => $input->getArgument('taxonomyVocabularyId'),
          ],
        ],
      ],
      default => [],
    };
  }

}

Главная | Обратная связь

drupal hosting | друпал хостинг | it patrol .inc