You are here

public function EntityShareClientCommands::pullChannel in Entity Share 8.3

Same name and namespace in other branches
  1. 8 modules/entity_share_client/src/Commands/EntityShareClientCommands.php \Drupal\entity_share_client\Commands\EntityShareClientCommands::pullChannel()
  2. 8.2 modules/entity_share_client/src/Commands/EntityShareClientCommands.php \Drupal\entity_share_client\Commands\EntityShareClientCommands::pullChannel()

Pull a channel from a remote website.

@command entity-share-client:pull @options remote-id Required. The remote website id to import from. @options channel-id Required. The remote channel id to import. @options import-config-id Required. The import config id to import with. @usage drush entity-share-client:pull --remote-id=site_1 --channel-id=articles_en --import-config-id=default Pull a channel from a remote website. The "Include count in collection queries" option should be enabled on the server website. This option is provided by the JSON:API Extras module.

Parameters

array $options: Additional command options.

File

modules/entity_share_client/src/Commands/EntityShareClientCommands.php, line 83

Class

EntityShareClientCommands
Class EntityShareClientCommands.

Namespace

Drupal\entity_share_client\Commands

Code

public function pullChannel(array $options = [
  'remote-id' => '',
  'channel-id' => '',
  'import-config-id' => '',
]) {

  // Validate options.
  $required_options = [
    'remote-id',
    'channel-id',
    'import-config-id',
  ];
  $missing_option = FALSE;
  foreach ($required_options as $required_option) {
    if (empty($options[$required_option])) {
      $missing_option = TRUE;
      $this
        ->logger()
        ->error(dt('Missing required option @option.', [
        '@option' => $required_option,
      ]));
    }
  }
  if (!$missing_option) {
    $this->cliService
      ->ioPull($options['remote-id'], $options['channel-id'], $options['import-config-id'], $this
      ->io(), 'dt');
  }
}