0

I have set up a new page in my admin for my module like so:

/**
 * Implements hook_menu().
 */
function scraper_menu() {
    $items = array();

    $items['admin/scraper'] = array(
        'title' => 'Scraper',
        'description' => 'The main action page in the admin area where we control our scrapers.',
        'page callback' => 'scraper_page',
        'access arguments' => array('administer users'),
        'type' => MENU_NORMAL_ITEM,
    );
    return $items;
}

/**
* Page callback: Scraper page
*
* @see scraper_menu()
*/
function scraper_page() {
    return '<p>Hello world</p>';
}

When I navigate to admin/scraper I get the following error:

Fatal error: Unsupported operand types in /######/includes/form.inc on line 1079

So how do I create a custom HTML page in the admin?

2

What you have tried is the right way to do. I have checked the same code snippet and its working for me in my D7 installation. Hopefully the issue will be with some other form element (probably custom block ) that has be assigned in this page, might have some syntax error.

Thanks

0
function scraper_page() {
  return array(
    '#markup' => '<p>Hello world</p>'
  );
}

try that.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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