You are here

public function ImceHelpController::index in IMCE 8

Same name and namespace in other branches
  1. 8.2 src/Controller/ImceHelpController.php \Drupal\imce\Controller\ImceHelpController::index()
1 string reference to 'ImceHelpController::index'
imce.routing.yml in ./imce.routing.yml
imce.routing.yml

File

src/Controller/ImceHelpController.php, line 55

Class

ImceHelpController
Controller routines for help routes.

Namespace

Drupal\imce\Controller

Code

public function index() {
  $build = [];
  $name = 'imce';
  $build['#theme'] = 'imce_help';
  $module_name = $this
    ->moduleHandler()
    ->getName($name);
  $build['#title'] = 'Imce File Manager Help';
  $temp = $this
    ->moduleHandler()
    ->invoke($name, 'help', [
    "help.page.{$name}",
    $this->routeMatch,
  ]);
  if (!is_array($temp)) {
    $temp = [
      '#markup' => $temp,
    ];
    $build['#markup'] = $temp['#markup'];
  }
  $build['top'] = $temp;
  $build['#videos'][1]['title'] = 'IMCE with CKEditor in Drupal 8';
  $build['#videos'][1]['video'] = 'https://www.youtube.com/embed/wnOmlvG4tRo';
  $build['#videos'][2]['title'] = 'Integration IMCE with image/file field in Drupal 8';
  $build['#videos'][2]['video'] = 'https://www.youtube.com/embed/MAHonUyKVc0';

  // Only print list of administration pages if the module in question has
  // any such pages associated with it.
  $extension_info = \Drupal::service('extension.list.module')
    ->getExtensionInfo($name);
  $admin_tasks = system_get_module_admin_tasks($name, $extension_info);
  if (!empty($admin_tasks)) {
    $links = [];
    foreach ($admin_tasks as $task) {
      $link['url'] = $task['url'];
      $link['title'] = $task['title'];
      $links[] = $link;
    }
    $build['links'] = [
      '#theme' => 'links__help',
      '#heading' => [
        'level' => 'h3',
        'text' => $this
          ->t('@module administration pages', [
          '@module' => $module_name,
        ]),
      ],
      '#links' => $links,
    ];
  }
  return $build;
}