You are here

function dialog_example_page in Dialog 7

Same name and namespace in other branches
  1. 6 example/dialog_example.module \dialog_example_page()

Menu callback for our dialog example page.

1 call to dialog_example_page()
dialog_example_ajax_callback in example/dialog_example.module
Menu callback for our AJAX
1 string reference to 'dialog_example_page'
dialog_example_menu in example/dialog_example.module
Implementation of hook_menu().

File

example/dialog_example.module, line 34
Provides a demonstration of using the Dialog API.

Code

function dialog_example_page() {

  // Add the required Dialog JavaScript and CSS.
  $examples['#attached']['library'] = array(
    array(
      'dialog',
      'dialog',
    ),
  );

  // Modules may add the 'use-dialog' class to a link to have its content
  // open in a dialog.
  $examples['links']['#theme'] = 'item_list';
  $examples['links']['#items'] = array(
    l('Simple test', 'dialog/nojs/example', array(
      'attributes' => array(
        'class' => array(
          'use-dialog',
          'use-ajax',
        ),
      ),
    )),
  );
  if (module_exists('dialog_user')) {
    $examples['links']['#items'][] = l('User login', 'user/login/nojs/', array(
      'attributes' => array(
        'class' => array(
          'use-dialog',
          'use-ajax',
        ),
      ),
    ));
    $examples['links']['#items'][] = l('User register', 'user/register/nojs/', array(
      'attributes' => array(
        'class' => array(
          'use-dialog',
          'use-ajax',
        ),
      ),
    ));
    $examples['links']['#items'][] = l('Request new password', 'user/password/nojs/', array(
      'attributes' => array(
        'class' => array(
          'use-dialog',
          'use-ajax',
        ),
      ),
    ));
  }
  return $examples;
}