Welcome To Our Shell

Mister Spy & Souheyl Bypass Shell

Current Path : /var/www/html/vendor/drush/drush/src/Drupal/Commands/field/

Linux ift1.ift-informatik.de 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
Upload File :
Current File : /var/www/html/vendor/drush/drush/src/Drupal/Commands/field/EntityTypeBundleAskTrait.php

<?php

namespace Drush\Drupal\Commands\field;

use Drupal\Core\Entity\EntityTypeBundleInfoInterface;
use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Entity\FieldableEntityInterface;
use Symfony\Component\Console\Input\InputInterface;

use function t;

/**
 * @property InputInterface $input
 * @property EntityTypeBundleInfoInterface $entityTypeBundleInfo
 * @property EntityTypeManagerInterface $entityTypeManager
 */
trait EntityTypeBundleAskTrait
{
    protected function askEntityType(): ?string
    {
        $entityTypeDefinitions = array_filter(
            $this->entityTypeManager->getDefinitions(),
            function (EntityTypeInterface $entityType) {
                return $entityType->entityClassImplements(FieldableEntityInterface::class);
            }
        );
        $choices = [];

        foreach ($entityTypeDefinitions as $entityTypeDefinition) {
            $choices[$entityTypeDefinition->id()] = $this->input->getOption('show-machine-names')
                ? $entityTypeDefinition->id()
                : $entityTypeDefinition->getLabel();
        }

        if (!$answer = $this->io()->choice('Entity type', $choices)) {
            throw new \InvalidArgumentException(t('The entityType argument is required.'));
        }

        return $answer;
    }

    protected function askBundle(): ?string
    {
        $entityTypeId = $this->input->getArgument('entityType');
        $entityTypeDefinition = $this->entityTypeManager->getDefinition($entityTypeId);
        $bundleEntityType = $entityTypeDefinition->getBundleEntityType();
        $bundleInfo = $this->entityTypeBundleInfo->getBundleInfo($entityTypeId);
        $choices = [];

        if ($bundleEntityType && $bundleInfo === []) {
            throw new \InvalidArgumentException(
                t('Entity type with id \':entityType\' does not have any bundles.', [':entityType' => $entityTypeId])
            );
        }

        if (!$bundleEntityType && count($bundleInfo) === 1) {
            // eg. User
            return $entityTypeId;
        }

        foreach ($bundleInfo as $bundle => $data) {
            $label = $this->input->getOption('show-machine-names') ? $bundle : $data['label'];
            $choices[$bundle] = $label;
        }

        if (!$answer = $this->io()->choice('Bundle', $choices)) {
            throw new \InvalidArgumentException(t('The bundle argument is required.'));
        }

        return $answer;
    }
}

bypass 1.0, Devloped By El Moujahidin (the source has been moved and devloped)
Email: contact@elmoujehidin.net bypass 1.0, Devloped By El Moujahidin (the source has been moved and devloped) Email: contact@elmoujehidin.net