Skip to content
Snippets Groups Projects
project_browser.module 2.49 KiB
Newer Older
 * Provides hook implementations for the Project Browser module.
use Drupal\project_browser\Plugin\ProjectBrowserSource\Recipes;
/**
 * Implements hook_help().
 */
function project_browser_help($route_name, RouteMatchInterface $route_match) {
  switch ($route_name) {
    case 'help.page.project_browser':
      $output = '';
      $output .= '<h3>' . t('About') . '</h3>';
      $output .= '<p>' . t("The Project Browser module allows users to easily search for available Drupal modules from your site. Enhanced filtering is provided so you can find what you need.") . '</p>';
      $output .= '<p>' . t('For more information, see the <a href=":project_browser">online documentation for the Project Browser module</a>.', [':project_browser' => 'https://www.drupal.org/docs/contributed-modules/project-browser']) . '</p>';
      $output .= '<h3>' . t('Uses') . '</h3>';
      $output .= '<dl>';
      $output .= '<dt>' . t('Browsing modules') . '</dt>';
      $output .= '<dd>' . t('Users who have the <em>Administer modules</em> can browse modules from the <a href=":project_browser_admin">Browse projects page</a>.', [':project_browser_admin' => Url::fromRoute('project_browser.browse')->toString()]) . '</dd>';
      $output .= '<dt>' . t('Accessing more modules') . '</dt>';
      $output .= '<dd>' . t('Users who have the <em>Administer site configuration</em> permission can select where to search for modules from the <a href=":project_browser_settings">Project Browser settings page</a>. This can include the modules already on your site as well as contributed modules on Drupal.org', [':project_browser_settings' => Url::fromRoute('project_browser.settings')->toString()]) . '</dd>';
      $output .= '</dl>';


/**
 * Implements hook_theme().
 */
function project_browser_theme() {
  return [
    'project_browser_main_app' => [
      'variables' => [],
    ],
  ];
}
/**
 * Implements hook_project_browser_source_info_alter().
 */
function project_browser_project_browser_source_info_alter(array &$definitions): void {
  if (class_exists(Recipe::class)) {
    $definitions['recipes'] = [
      'id' => 'recipes',
      'label' => t('Recipes'),
      'description' => t('Recipes available in the local code base'),
      'local_task' => [
        'weight' => ($definitions['drupalorg_jsonapi']['local_task']['weight'] ?? 5) + 2,
      ],