installation_checklist-1.0.x-dev/installation_checklist.module

installation_checklist.module
<?php

/**
 * @file
 * Provides a checklist to guide actions to perform after installation.
 */

use Drupal\Core\Url;

/**
 * Implements hook_checklistapi_checklist_info().
 *
 * Provides the installation checklist metadata.
 */
function installation_checklist_checklistapi_checklist_info() {
  $definitions = [];
  $definitions['installation_checklist'] = [
    '#title' => t('Finish setting up your site'),
    '#path' => '/admin/config/installation-checklist',
    '#callback' => 'installation_checklist_checklistapi_checklist_items',
    '#description' => t('Complete your installation.'),
    '#help' => t("<p>Check off each task as you complete it. Don't forget to click the <em>Save</em> button!</p>"),
  ];
  return $definitions;
}

/**
 * Callback for installation checklist items.
 */
function installation_checklist_checklistapi_checklist_items(): array {
  $project_browser_exists = \Drupal::moduleHandler()->moduleExists('project_browser');
  return [
    'setup' => [
      '#title' => t('Finish setting up your site'),
      '#description' => t('Finish setting up your site.'),
      'account_setup' => [
        '#title' => t('Finish setting up your account.'),
        '#description' => t('Finish setting up your account.'),
        'link' => [
          '#text' => t("Edit user"),
          '#url' => Url::fromRoute('user.edit'),
        ],
      ],
      'create_content' => [
        '#title' => t('Create your first content page'),
        '#description' => t('Create your first content page.'),
        'link' => [
          '#text' => t("Create content"),
          '#url' => Url::fromRoute('node.add_page'),
        ],
      ],
      'extend_drupal' => [
        '#title' => t('Extend Drupal'),
        '#description' => t('Extend Drupal with new functionalities.'),
        'link' => [
          '#text' => t("Extend Drupal"),
          '#url' => Url::fromRoute($project_browser_exists ? 'project_browser.browse' : 'system.modules_list'),
        ],
      ],
      'invite_others' => [
        '#title' => t('Invite others'),
        '#description' => t('Create new users.'),
        'link' => [
          '#text' => t("Create new users."),
          '#url' => Url::fromRoute('entity.user.collection'),
        ],
      ],
      'learn' => [
        '#title' => t('Learn to build with Drupal'),
        '#description' => t('Learn to build with Drupal. Read the documentation.'),
        'link' => [
          '#text' => t("Create new users."),
          '#url' => Url::fromUri('https://www.drupal.org/documentation'),
        ],
      ],
      'appearance' => [
        '#title' => t('Change appearance'),
        '#description' => t('Change appearance.'),
        'link' => [
          '#text' => t("Change appearance."),
          '#url' => Url::fromRoute('system.themes_page'),
        ],
      ],
    ],
  ];
}

/**
 * Implements hook_theme().
 */
function installation_checklist_theme() {
  return [
    'installation_checklist_block' => [
      'variables' => [
        'message' => '',
        'number_complete' => 0,
        'number_of_items' => 0,
        'percent_complete' => 0,
      ],
    ],
  ];
}

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

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