0

This is my hook_menu.

function coverflow_menu(){
        $items = array();

        $items['coverflow']  = array(
            'title'           => 'Coverflow Slider',
            'page callback'     => 'coverflow_page',
            'access arguments'=> array('access content'),
        );

        $items['admin/config/coverflow'] = array(
                'title'                 => 'Coverflow Settings',
                'description'         => 'Coverflow Slider Settings.',
                'type'                  => 'MENU_NORMAL_ITEM',
                'page callback'     => 'drupal_get_form',
                'page arguments'    => array('coverflow_admin_form'),
                'access arguments'=> array('administer site configuration'),
                'file'            => 'coverflow_admin_form.inc',
                'file path'       => drupal_get_path('module', 'coverflow'),
            );

        return $items;
   }

And this is my callback function for coverflow_admin_form

function coverflow_admin_form($form, &$form_state){

    $form           = array();

    $form['height'] = array(
      '#title' => t('Height'),
      '#type' => 'textfield',
      '#size' => 40,
      '#maxlength' => 120,
      '#required' => TRUE,
    );  

    $form['width'] = array(
      '#title' => t('Width'),
      '#type' => 'textfield',
      '#size' => 40,
      '#maxlength' => 120,
      '#required' => TRUE,
    );

    $form['font-size'] = array(
      '#title' => t('Font Size'),
      '#type'   => 'textfield',
      '#size'   => 40,
      '#maxlength' => 120,
      '#required' => TRUE,
    );

    $form['font-family'] = array(
      '#title' => t('Font Family'),
      '#type'   => 'textfield',
      '#size'   => 40,
      '#maxlength' => 120,
      '#required' => TRUE,
    );

    $form['font-color'] = array(
      '#title' => t('Font Color'),
      '#type'   => 'textfield',
      '#size'   => 40,
      '#maxlength' => 120,
      '#required' => TRUE,
    );

    $form['submit'] = array(
        '#type' => 'submit',
        '#value' => t('Save settings'),
    );

        return system_settings_form($form);

}

After installing module im not getting configuration link at admin/config/coverflow.

What is wrong in this code?

8
  • Url for configuration page is not correct. It should be admin/config/development/coverflow or admin/config/content/coverflow or for any other section in admin. Nov 14, 2013 at 6:56
  • ok let me try this option.
    – Shamsher
    Nov 14, 2013 at 6:57
  • after changing admin/config/coverflow to admin/config/development/coverflow, my hook_menu link is disappear and complete code is not working.
    – Shamsher
    Nov 14, 2013 at 7:01
  • Have you clear the cache and test it? Nov 14, 2013 at 7:02
  • yes after updating module files, im clearing cache and sometimes uninstalling module and then installing again to check updates. but still its not working.
    – Shamsher
    Nov 14, 2013 at 7:03

1 Answer 1

0

Got the solution, just have to remove '' from 'MENU_NORMAL_ITEM' because MENU_NORMAL_ITEM is drupal constant for handling Menu Items, after removing '' the code is working as expected.

1
  • I was also adding the same as my answer. But your url was also not proper for configuration page. Nov 14, 2013 at 7:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.