Tag Archives: admin/config

[Solved] Add module to admin/config page in Drupal7

We are going to create a following custom block in admin/config page.
Drupal admin/config block - Configure Products

To create a block in admin/config like those ‘People, Content Authoring, Media’ etc. We need to define two menu items as shown below


function products_menu() {
$items = array();
$items['admin/config/products'] = array(
      'title' => 'Configure Products',
      'description' => 'Allows administrators to configure product items',
      'weight' => -30,
      'page callback' => 'drupal_get_form',
      'page arguments' => array('products_admin_settings_form'),
      'access arguments' => array('administer products'),
      'file' => 'products.admin.inc',
  );

  $items['admin/config/products/manage'] = array(
      'title' => 'Manage Products',
      'description' => 'Allows admins to manage products',
      'page callback' => 'drupal_get_form',
      'page arguments' => array('products_admin_settings_form'),
      'access arguments' => array('administer products'),
      'file' => 'products.admin.inc',
      'weight' => -10,
  );

  return $items;
}

admin/config/products – highlighted above line no. 3

Creates a new block with title Configure Products

admin/config/products/manage – highlighted above line no. 13

This menu item is visible under the Configure Products as clickable item. When this link “Manage Products” is clicked, it invokes the ‘products_admin_settings_form’ page callback which eventually displays a form for products configuration.

If there is any confusions please post them on comment.