Newer
Older

Ben Mullins
committed
<?php

Tim Plunkett
committed
/**
* @file

narendraR
committed
* Provides hook implementations for the Project Browser module.

Tim Plunkett
committed
*/

Adam G-H
committed
use Drupal\Core\Recipe\Recipe;

narendraR
committed
use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\Core\Url;

Adam G-H
committed
use Drupal\project_browser\Plugin\ProjectBrowserSource\Recipes;

Ben Mullins
committed

narendraR
committed
/**
* 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>';

narendraR
committed
return $output;

Ben Mullins
committed
}

Tim Plunkett
committed
}

narendraR
committed
/**
* Implements hook_theme().
*/
function project_browser_theme() {
return [
'project_browser_main_app' => [
'variables' => [],
],
];
}

Fran Garcia-Linares
committed

Adam G-H
committed
/**
* 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'),

Pamela Barone
committed
'description' => t('Recipes available in the local code base'),

Adam G-H
committed
'local_task' => [
'weight' => ($definitions['drupalorg_jsonapi']['local_task']['weight'] ?? 5) + 2,
],