Move farmOS help page code to new farm_help module.

This commit is contained in:
Michael Stenta 2017-06-27 15:34:43 -04:00
parent 5b3ba071e5
commit 610784d38f
7 changed files with 98 additions and 68 deletions

View File

@ -44,6 +44,7 @@ dependencies[] = farm_admin
dependencies[] = farm_area
dependencies[] = farm_asset
dependencies[] = farm_fields
dependencies[] = farm_help
dependencies[] = farm_log
dependencies[] = farm_map
dependencies[] = farm_people

View File

@ -536,10 +536,10 @@ function farm_update_7024(&$sandbox) {
}
/**
* Install the Farm People and Farm UI modules.
* Install the new Farm Help, People, and UI modules.
*/
function farm_update_7025(&$sandbox) {
_farm_update_enable_modules(array('farm_people', 'farm_ui'));
_farm_update_enable_modules(array('farm_help', 'farm_people', 'farm_ui'));
}
/**

View File

@ -24,10 +24,6 @@ function farm_admin_permission() {
'title' => t('Access farm dashboard'),
'description' => t('Access the farm dashboard.'),
),
'access farm help' => array(
'title' => t('Access farm help pages'),
'description' => t('Access the farm help pages.'),
),
);
}
@ -40,9 +36,6 @@ function farm_admin_farm_access_perms($role) {
// Access farm dashboard.
$perms[] = 'access farm dashboard';
// Access farm help.
$perms[] = 'access farm help';
return $perms;
}
@ -63,15 +56,6 @@ function farm_admin_menu() {
'weight' => -100,
);
$items['farm/help'] = array(
'title' => 'Help',
'page callback' => 'farm_admin_help_page',
'access arguments' => array('access farm help'),
'type' => MENU_NORMAL_ITEM,
'menu_name' => 'user-menu',
'weight' => 100,
);
// Root farm configuration path.
$items['admin/config/farm'] = array(
'title' => 'Farm',
@ -118,48 +102,6 @@ function farm_admin_dashboard() {
return $output;
}
/**
* Farm help page callback.
*/
function farm_admin_help_page() {
// Set the title so it is different than the menu item.
drupal_set_title(t('farmOS Resources'));
// Create output array.
$output = array();
// Allow other modules to add output.
$contrib_output = module_invoke_all('farm_admin_help_page');
$output = array_merge($output, $contrib_output);
// Return the output, imploded into a string.
return implode('', $output);
}
/**
* Implements hook_farm_admin_help_page().
*/
function farm_admin_farm_admin_help_page() {
$output = array();
// Add general text.
$output[] = '<p>' . l('farmOS', 'http://farmos.org'). ' is built and maintained
by a community of volunteers. Some farmOS community resources are listed
below.</p>';
// Add a link to the farmOS documentation.
$output[] = '<h3>Documentation</h3><p>' . l('http://farmos.org', 'http://farmos.org') . '</h3>';
// Add a link to the farmOS IRC channel.
$output[] = '<h3>Community Chat</h3><p>' . l('#farmOS IRC channel on Freenode', 'http://webchat.freenode.net/?channels=#farmOS') . '</p>';
// Add a link to the farmOS distribution issue queue.
$output[] = '<h3>Issue Queues</h3><p>' . l('https://drupal.org/project/issues/farm', 'https://drupal.org/project/issues/farm') . '</p>';
return $output;
}
/**
* Implements hook_menu_breadcrumb_alter().
*/

View File

@ -2,7 +2,7 @@
/**
* @file
* Hooks provided by farm_admin.
* Hooks provided by farm_help.
*
* This file contains no working PHP code; it exists to provide additional
* documentation for doxygen as well as to document hooks in the standard
@ -10,15 +10,15 @@
*/
/**
* @defgroup farm_admin Farm admin module integrations.
* @defgroup farm_help Farm help module integrations.
*
* Module integrations with the farm_admin module.
* Module integrations with the farm_help module.
*/
/**
* @defgroup farm_admin_hooks farm_admin's hooks
* @defgroup farm_help_hooks farm_help's hooks
* @{
* Hooks that can be implemented by other modules in order to extend farm_admin.
* Hooks that can be implemented by other modules in order to extend farm_help.
*/
/**
@ -27,7 +27,7 @@
* @return array
* Returns an array of actions and their meta information (see example below).
*/
function hook_farm_admin_help_page() {
function hook_farm_help_page() {
// Add a link to farmOS.rog
$output = array(

View File

@ -0,0 +1,4 @@
name = Farm Help
description = Help pages for farmOS.
core = 7.x
package = farmOS

View File

@ -0,0 +1,83 @@
<?php
/**
* @file
* Farm help module.
*/
/**
* Implements hook_permission().
*/
function farm_help_permission() {
return array(
'access farm help' => array(
'title' => t('Access farm help pages'),
'description' => t('Access the farm help pages.'),
),
);
}
/**
* Implements hook_farm_access_perms().
*/
function farm_help_farm_access_perms($role) {
// Access farm help.
return array('access farm help');
}
/**
* Implements hook_menu().
*/
function farm_help_menu() {
$items['farm/help'] = array(
'title' => 'Help',
'page callback' => 'farm_help_page_callback',
'access arguments' => array('access farm help'),
'type' => MENU_NORMAL_ITEM,
'menu_name' => 'user-menu',
'weight' => 100,
);
return $items;
}
/**
* Farm help page callback.
*/
function farm_help_page_callback() {
// Set the title so it is different than the menu item.
drupal_set_title(t('farmOS Resources'));
// Create output array.
$output = array();
// Allow other modules to add output.
$contrib_output = module_invoke_all('farm_help_page');
$output = array_merge($output, $contrib_output);
// Return the output, imploded into a string.
return implode('', $output);
}
/**
* Implements hook_farm_help_page().
*/
function farm_help_farm_help_page() {
$output = array();
// Add general text.
$output[] = '<p>' . l('farmOS', 'http://farmos.org'). ' is built and maintained
by a community of volunteers. Some farmOS community resources are listed
below.</p>';
// Add a link to the farmOS documentation.
$output[] = '<h3>Documentation</h3><p>' . l('http://farmos.org', 'http://farmos.org') . '</h3>';
// Add a link to the farmOS IRC channel.
$output[] = '<h3>Community Chat</h3><p>' . l('#farmOS IRC channel on Freenode', 'http://webchat.freenode.net/?channels=#farmOS') . '</p>';
// Add a link to the farmOS distribution issue queue.
$output[] = '<h3>Issue Queues</h3><p>' . l('https://drupal.org/project/issues/farm', 'https://drupal.org/project/issues/farm') . '</p>';
return $output;
}

View File

@ -20,9 +20,9 @@ function farm_theme_preprocess_menu_link(&$vars) {
}
/**
* Implements hook_farm_admin_help_page().
* Implements hook_farm_help_page().
*/
function farm_tour_farm_admin_help_page() {
function farm_tour_farm_help_page() {
// Add links to the available tours.
$output = '<h3>Guided Tours</h3>';