' . 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.") . '
'; return $output; case 'admin/modules#description': return t('Allows the user to configure the layout of questions and answers on a FAQ page.'); } } /** * Implements hook_permission(). */ function faq_permission() { return array( 'administer faq' => array( 'title' => t('Administer FAQ module'), ), 'administer faq order' => array( 'title' => t('Administer FAQ order'), ), 'view faq page' => array( 'title' => t('View FAQ pages'), ), ); } /** * Implements hook_node_access(). */ function faq_node_access($node, $op, $account = NULL) { global $user; if (empty($account)) { $account = $user; } // Ignore non-FAQ node. if ((is_object($node) ? $node->type : $node) !== 'faq') { return NODE_ACCESS_IGNORE; } if ($op != 'create') { $node = (object) $node; } if ($op == 'view') { return NODE_ACCESS_IGNORE; } elseif ($op == 'create' || $op == 'update' || $op == 'delete') { if (user_access('administer faq')) { return NODE_ACCESS_ALLOW; } } return NODE_ACCESS_IGNORE; } /** * Implements hook_menu(). */ function faq_menu() { $items = array(); $items['faq-page'] = array( 'title' => 'Frequently Asked Questions', 'page callback' => 'faq_page', 'access callback' => 'user_access', 'access arguments' => array('view faq page'), 'weight' => 1, 'type' => MENU_SUGGESTED_ITEM, ); $items['faq-page/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-page/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-page/%'] = 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-page/%/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-page/%/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/config/content/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/config/content/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/config/content/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/config/content/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; } /** * Implements 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'), 'base' => 'faq', 'description' => t('A frequently asked question and its answer.'), 'title_label' => t('Question'), ), ); } /** * Implements hook_form(). * * @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