Skip to content

Instantly share code, notes, and snippets.

@drupalista-br
Created January 26, 2013 06:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save drupalista-br/4640536 to your computer and use it in GitHub Desktop.
Save drupalista-br/4640536 to your computer and use it in GitHub Desktop.
<?php
/**
* Implements hook_menu().
*
* Sets up calls to drupal_get_form() for all our example cases.
*
* @see menu_example.module
* @see menu_example_menu()
*/
function ajax_example_menu() {
$items = array();
...
// Use the AJAX framework outside the context of a form using the use-ajax
// class. See ajax_example_misc.inc.
$items['examples/ajax_example/ajax_link'] = array(
'title' => 'Ajax Link ("use-ajax" class)',
'page callback' => 'ajax_example_render_link',
'access callback' => TRUE,
'file' => 'ajax_example_misc.inc',
'weight' => 9,
);
// Use the AJAX framework outside the context of a form using a renderable
// array of type link with the #ajax property. See ajax_example_misc.inc.
$items['examples/ajax_example/ajax_link_renderable'] = array(
'title' => 'Ajax Link (Renderable Array)',
'page callback' => 'ajax_example_render_link_ra',
'access callback' => TRUE,
'file' => 'ajax_example_misc.inc',
'weight' => 9,
);
// A menu callback is required when using ajax outside of the Form API.
$items['ajax_link_callback'] = array(
'page callback' => 'ajax_link_response',
'access callback' => 'user_access',
'access arguments' => array('access content'),
'type' => MENU_CALLBACK,
'file' => 'ajax_example_misc.inc',
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment