tome-8.x-1.x-dev/modules/tome_sync/src/Commands/ImportContentCommand.php

modules/tome_sync/src/Commands/ImportContentCommand.php
<?php

namespace Drupal\tome_sync\Commands;

use Drupal\tome_sync\TomeSyncHelper;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

/**
 * Contains the tome:import-content command.
 *
 * @internal
 */
class ImportContentCommand extends ImportCommand {

  /**
   * {@inheritdoc}
   */
  protected  function configure() {
    $this->setName('tome:import-content')
      ->setDescription('Imports given content.')
      ->addArgument('names', InputArgument::REQUIRED, 'A comma separated list of IDs in the format entity_type_id:uuid:langcode.');
  }

  /**
   * {@inheritdoc}
   */
  protected function execute(InputInterface $input, OutputInterface $output): int {
    $names = $input->getArgument('names');
    $names = explode(',', $names);
    foreach ($names as $name) {
      list($entity_type_id, $uuid, $langcode) = TomeSyncHelper::getPartsFromContentName($name);
      $this->importer->importContent($entity_type_id, $uuid, $langcode);
    }
    return 0;
  }

}

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

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