You are here

public function ContentSyncHelpManager::buildHelpMenu in Content Synchronization 8.2

Same name and namespace in other branches
  1. 8 src/ContentSyncHelpManager.php \Drupal\content_sync\ContentSyncHelpManager::buildHelpMenu()
  2. 3.0.x src/ContentSyncHelpManager.php \Drupal\content_sync\ContentSyncHelpManager::buildHelpMenu()

Build help (aka 'How can we help you?') menu (dropbutton) element.

Return value

array An render array containing about (aka 'How can we help you?') operations (dropbutton) element.

Overrides ContentSyncHelpManagerInterface::buildHelpMenu

1 call to ContentSyncHelpManager::buildHelpMenu()
ContentSyncHelpManager::buildAbout in src/ContentSyncHelpManager.php
Build the about section.

File

src/ContentSyncHelpManager.php, line 191

Class

ContentSyncHelpManager
Content Sync help manager.

Namespace

Drupal\content_sync

Code

public function buildHelpMenu() {
  $default_query = [
    'title' => '{Your title should be descriptive and concise}',
    'version' => $this->state
      ->get('content_sync.version'),
  ];
  $issue_query = $default_query + [
    'body' => "\n<h3>Problem/Motivation</h3>\n(Why the issue was filed, steps to reproduce the problem, etc.)\n\nSUGGESTIONS\n\n* Search existing issues.\n* Try Simplytest.me\n* Export and attach an example YAML files.\n\n<h3>Proposed resolution</h3>\n(Description of the proposed solution, the rationale behind it, and workarounds for people who cannot use the patch.)",
  ];
  $feature_query = $default_query + [
    'body' => "\n<h3>Problem/Motivation</h3>\n(Explain why this new feature or functionality is important or useful.)\n\n<h3>Proposed resolution</h3>\n(Description of the proposed solution, the rationale behind it, and workarounds for people who cannot use the patch.)",
  ];
  $links = [];
  $links['index'] = [
    'title' => $this
      ->t('How can we help you?'),
    'url' => Url::fromRoute('content.help.about'),
    'attributes' => [
      'class' => [
        'use-ajax',
      ],
      'data-dialog-type' => 'modal',
      'data-dialog-options' => Json::encode([
        'width' => 640,
      ]),
    ],
  ];
  $links['documentation'] = [
    'title' => $this
      ->t('Read Content Sync Documentation'),
    'url' => Url::fromUri('https://www.drupal.org/project/content_sync', [
      'attributes' => [
        'target' => '_blank',
      ],
    ]),
  ];
  $links['issue'] = [
    'title' => $this
      ->t('Report a Bug/Issue'),
    'url' => Url::fromUri('https://www.drupal.org/node/add/project-issue/content_sync', [
      'query' => $issue_query,
      'attributes' => [
        'target' => '_blank',
      ],
    ]),
  ];
  $links['request'] = [
    'title' => $this
      ->t('Request Feature'),
    'url' => Url::fromUri('https://www.drupal.org/node/add/project-issue/content_sync', [
      'query' => $feature_query,
      'attributes' => [
        'target' => '_blank',
      ],
    ]),
  ];
  $links['support'] = [
    'title' => $this
      ->t('Additional Support'),
    'url' => Url::fromUri('https://www.drupal.org/project/content_sync', [
      'attributes' => [
        'target' => '_blank',
      ],
    ]),
  ];

  /*$links['community'] = [
      'title' => $this->t('Join the Drupal Community'),
      'url' => Url::fromUri('https://register.drupal.org/user/register', ['query' => ['destination' => '/project/content_sync'], 'attributes' => ['target' => '_blank']]),
    ];
    $links['association'] = [
      'title' => $this->t('Support the Drupal Association'),
      'url' => Url::fromUri('https://www.drupal.org/association/campaign/value-2017', ['attributes' => ['target' => '_blank']]),
    ];*/
  return [
    '#type' => 'container',
    '#attributes' => [
      'class' => [
        'content_sync-help-menu',
      ],
    ],
    'operations' => [
      '#type' => 'operations',
      '#links' => $links,
    ],
  ];
}