I'm more of a PHP guy with minimal knowledge of the tenets of Drupal module development - but I'm learning on the fly. Currently I'm working on developing a module with two or more functionalities that would only be accessible to the admin, and want to develop a reasonable UI that would allow them to perform certain operations. As far as the functionalities are concerned, I have them down in PHP snippets. I'm just looking for the best way to set up pages on the site that would allow convenient and secure use of the module.

As far as content development on the actual website goes, I'm pretty ok with it, but as this module would be an integral tool on the site, and privileges granted only to the admin, I'd rather have it as separate tool accessible via the Drupal toolbar menu or something, rather than links on the actual website, as the pages will not be actual content on the website.

Sorry for the lack of technicality in my phrasing, I'm just not accustomed to Drupal terminology. I hope it makes sense, though somehow; I just need basic directions on how I should go about it, and any relevant links would be welcome.

Comments

xandiel’s picture

firstly you need to create your own permissions via hook_permission

then create a menu that links to admin/config/xxx and admin/config/xxx/configuration via hook_menu

<?php
    $items['admin/config/xxx'] = array(
        'title' => 'xxx Module',
        'description' => 'Administer xxx.',
        'position' => 'right',
        'weight' => -50,
        'page callback' => 'function found in the file xxx.admin.inc that checks permission',
        'access arguments' => array('your permission'),
        'file' => 'xxx.admin.inc',
    );

    $items['admin/config/xxx/configuration'] = array(
        'title' => 'Configuration',
        'description' => 'Administer xxx Configuration',
        'page callback' => 'drupal_get_form',
        'page arguments' => array('function found in the file xxx.admin.inc'),
        'access arguments' => array('your permission'),
        'file' => 'xxx.admin.inc',
        'weight' => 1
    );
?>
nitin.k’s picture

Please install examples modules on your local site.
See the basic modules like forms and pages for an overview.
You need to use hook_permission() function to decide the accessibility.
Then enable them from here .. http://site--url/admin/people/permissions

<?php
/**
* @file
* module file for reference.
*
*/

/**
* Implements hook_permission().
*/
function somemodule_permission() {
  return array(
    'module permssion name' => array(
      'title' => t('Module permission title'),
      'description' => t('Module permission description'),
    ),
  );
}

/**
* Implements hook_menu().
*/
function somemodule_menu() {
  // Administration pages.
  $items['someurl'] = array(
    'title' => 'Some title',
    'description' => 'Put description here..',
    'page callback' => 'put callback function name here',
    'access arguments' => array('module permssion name'),
  );
   return $items;
 }