You are here

function feeds_help in Feeds 8.3

Implements hook_help().

File

./feeds.module, line 20
Feeds hook implementations.

Code

function feeds_help($route_name, RouteMatchInterface $route_match) {
  switch ($route_name) {
    case 'entity.feeds_feed_type.collection':
      return '<p>' . t('Create one or more feed types for pulling content into Drupal.') . '</p>';
    case 'entity.feeds_feed_type.mapping':
      $doc_link = [
        '#type' => 'link',
        '#url' => Url::fromUri('https://www.drupal.org/docs/8/modules/feeds/creating-and-editing-import-feeds#mapping'),
        '#title' => t('Mapping documentation'),
        '#attributes' => [
          'target' => '_new',
        ],
      ];
      return new FormattableMarkup('<p>@help1</p><p>@help2</p><p>@help3</p>', [
        '@help1' => t('Define which elements of a single item of a feed (= %sources_label) map to which content pieces in Drupal (= %targets_label). To avoid importing duplicates, make sure that at least one definition has an %unique_target_label. An unique target means that a value for a target can only occur once. For example, only one item with the URL %example_url can exist.', [
          '%sources_label' => t('Sources'),
          '%targets_label' => t('Targets'),
          '%unique_target_label' => t('Unique target'),
          '%example_url' => 'http://example.com/content/1',
        ]),
        '@help2' => t('On %read_only_label targets a value can only be set the first time.', [
          '%read_only_label' => t('Read only'),
        ]),
        '@help3' => t('See the @doc_link for more information.', [
          '@doc_link' => \Drupal::service('renderer')
            ->renderRoot($doc_link),
        ]),
      ]);
    case 'entity.feeds_feed.import_form':
      return '<p>' . t("The import task will run immediately, in the web UI. Don't close the browser until the import has been completed or the import would stop.") . '</p>';
    case 'entity.feeds_feed.schedule_import_form':
      $cron_required = [
        '#type' => 'link',
        '#url' => Url::fromUri('https://www.drupal.org/docs/user_guide/en/security-cron.html'),
        '#title' => t('Requires cron to be configured.'),
        '#attributes' => [
          'target' => '_new',
        ],
      ];
      return '<p>' . t('This is useful for large imports. The import task will be put on a queue and handled by a cron task.') . ' ' . \Drupal::service('renderer')
        ->renderRoot($cron_required) . '</p>';
    case 'entity.feeds_feed.edit_form':
      $feed = $route_match
        ->getParameter('feeds_feed');
      $type = $feed
        ->getType();
      $help = $type
        ->getHelp();
      return !empty($help) ? Xss::filterAdmin($help) : '';
    case 'entity.feeds_feed.add_form':
      $type = $route_match
        ->getParameter('feeds_feed_type');
      $help = $type
        ->getHelp();
      return !empty($help) ? Xss::filterAdmin($help) : '';
  }
}