'. t("This module allows users with the 'administer faq' permission to create question and answer pairs which will be displayed on the 'faq' page. The 'faq' page is automatically generated from the FAQ nodes configured and the layout of this page can be modified on the settings page. Users will need the 'view faq page' permission in order to view the 'faq' page.") .'
'. ''. t("To create a question and answer, the user must create a 'FAQ' node (Create content >> FAQ). This screen allows the user to edit the question and answer text. If the 'Taxonomy' module is enabled and there are some terms configured for the FAQ node type, it will also be possible to put the questions into different categories when editing.") .'
'. ''. t("The 'Frequently Asked Questions' settings configuration screen will allow users with 'administer faq' permissions to specify different layouts of the questions and answers.") .'
'. ''. t("All users with 'view faq page' permissions will be able to view the generated FAQ page at 'www.example.com/faq'.") .'
'; return $output; case "admin/modules#description": return t("Allows the user to configure the layout of questions and answers on a FAQ page."); case "node/add/faq": return t("Add a question and answer to a FAQ list."); } } /** * Implementation of hook_perm(). */ function faq_perm() { return array('administer faq', 'view faq page', 'edit own faq', 'edit faq', 'create faq', 'administer faq order'); } /** * Implementation of hook_access(). */ function faq_access($op, $node, $account = NULL) { global $user; if (empty($account)) { $account = $user; } if ($op != 'create') { $node = (object)$node; } if ($op == 'create') { if (user_access('create faq') || user_access('administer faq')) { return TRUE; } } elseif ($op == 'update' || $op == 'delete') { if (user_access('edit faq') || user_access('administer faq')) { return TRUE; } elseif (user_access('edit own faq') && $account->uid == $node->uid) { return TRUE; } } } /** * Implementation of hook_menu(). */ function faq_menu() { $items = array(); $items['faq'] = array( 'title' => 'Frequently Asked Questions', 'page callback' => 'faq_page', 'access callback' => 'user_access', 'access arguments' => array('view faq page'), 'weight' => 1, ); $items['faq/list'] = array( 'title' => 'List', 'page callback' => 'faq_page', 'access callback' => 'user_access', 'access arguments' => array('view faq page'), 'weight' => -10, 'type' => MENU_DEFAULT_LOCAL_TASK, ); $items['faq/order'] = array( 'title' => 'Order', 'description' => 'Allows the user to configure the order of questions and answers on a FAQ page.', 'file' => 'faq.admin.inc', 'page callback' => 'drupal_get_form', 'page arguments' => array('faq_order_settings_form'), 'access callback' => 'user_access', 'access arguments' => array('administer faq order'), 'type' => MENU_LOCAL_TASK, 'weight' => -8, ); $items['faq/%'] = array( 'title' => 'Frequently Asked Questions', 'page callback' => 'faq_page', 'page arguments' => array(1), 'access callback' => 'user_access', 'access arguments' => array('view faq page'), 'type' => MENU_CALLBACK, ); $items['faq/%/list'] = array( 'title' => 'List', 'page callback' => 'faq_page', 'page arguments' => array(1), 'access callback' => 'user_access', 'access arguments' => array('view faq page'), 'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -10, ); $items['faq/%/order'] = array( 'title' => 'Order', 'description' => 'Allows the user to configure the order of questions and answers on a FAQ page.', 'file' => 'faq.admin.inc', 'page callback' => 'drupal_get_form', 'page arguments' => array('faq_order_settings_form', 1), 'access callback' => 'user_access', 'access arguments' => array('administer faq order'), 'type' => MENU_LOCAL_TASK, 'weight' => -8, ); $items['admin/settings/faq'] = array( 'title' => 'Frequently Asked Questions', 'description' => 'Allows the user to configure the layout of questions and answers on a FAQ page.', 'file' => 'faq.admin.inc', 'page callback' => 'faq_settings_page', 'access callback' => 'user_access', 'access arguments' => array('administer faq'), ); $items['admin/settings/faq/general'] = array( 'title' => 'General', 'description' => 'Allows the user to configure the header and descriptive text for the FAQ page.', 'file' => 'faq.admin.inc', 'page callback' => 'drupal_get_form', 'page arguments' => array('faq_general_settings_form'), 'access callback' => 'user_access', 'access arguments' => array('administer faq'), 'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -10, ); $items['admin/settings/faq/questions'] = array( 'title' => 'Questions', 'description' => 'Allows the user to configure the layout of questions and answers on a FAQ page.', 'file' => 'faq.admin.inc', 'page callback' => 'drupal_get_form', 'page arguments' => array('faq_questions_settings_form'), 'access callback' => 'user_access', 'access arguments' => array('administer faq'), 'type' => MENU_LOCAL_TASK, 'weight' => -9, ); $items['admin/settings/faq/categories'] = array( 'title' => 'Categories', 'description' => 'Allows the user to configure the layout of questions and answers using categories on a FAQ page.', 'file' => 'faq.admin.inc', 'page callback' => 'drupal_get_form', 'page arguments' => array('faq_categories_settings_form'), 'access callback' => 'user_access', 'access arguments' => array('administer faq'), 'type' => MENU_LOCAL_TASK, 'weight' => -8, ); return $items; } /** * Implementation of hook_node_info(). * * Defines the FAQ node/content type. * @return * An array, containing the title, module name and the description. */ function faq_node_info() { return array( 'faq' => array( 'name' => t('FAQ'), 'module' => 'faq', 'description' => t('A frequently asked question and its answer.'), 'title_label' => t('Question'), 'body_label' => t('Answer'), ) ); } /** * Defines the form where new questions and answers are written. * * @param &$node * The node being added or edited. * @param &$param * The hook can set this variable to an associative array of attributes to add * to the enclosing