You are here

function _jquery_ui_filter_dialog_demo in jQuery UI filter 7

Same name and namespace in other branches
  1. 6 dialog/jquery_ui_filter_dialog.admin.inc \_jquery_ui_filter_dialog_demo()

jQuery UI filter Dialog demo.

File

dialog/jquery_ui_filter_dialog.admin.inc, line 254
Administration pages for the 'jQuery UI filter dialog' module.

Code

function _jquery_ui_filter_dialog_demo(&$form_state) {
  if (isset($form_state['post']['dialog_source'])) {
    $dialog_source = $form_state['post']['dialog_source'];
  }
  else {
    global $user;
    $dialog_links = array(
      array(
        'title' => t('Edit Your User Account (with Tabs)'),
        'href' => 'user/' . $user->uid . '/edit',
        'attributes' => array(
          'title' => t('Your Account'),
          'target' => '[dialog]',
          'rel' => "{'dialogFeatures':'page-tabs=0'}",
        ),
      ),
      array(
        'title' => t('Edit Your User Account (without Tabs)'),
        'href' => 'user/' . $user->uid . '/edit',
        'attributes' => array(
          'title' => t('Your Account'),
          'target' => '[dialog]',
          'rel' => "{'dialogFeatures':'page-tabs=1'}",
        ),
      ),
      array(
        'title' => t('Help (Full Screen)'),
        'href' => 'admin/help',
        'attributes' => array(
          'title' => t('Help'),
          'target' => '[dialog]',
          'rel' => "{'height':'auto', 'width':'auto'}",
        ),
      ),
      array(
        'title' => t('Help (Over-sized)'),
        'href' => 'admin/help',
        'attributes' => array(
          'title' => t('Help'),
          'target' => '[dialog]',
          'rel' => "{'height':4000, 'width':800}",
        ),
      ),
      array(
        'title' => t('Drupal.org (Example of external URL the must be whitelisted)'),
        'href' => 'http://drupal.org',
        'attributes' => array(
          'title' => t('Drupal.org'),
          'target' => '[dialog]',
        ),
      ),
    );
    if (module_exists('contact')) {
      $dialog_links[] = array(
        'title' => t('Contact'),
        'href' => 'contact',
        'attributes' => array(
          'title' => t('Contact (600x600 modal)'),
          'target' => '[dialog]',
          'rel' => "{'modal': true, 'height': 600, 'width': 600}",
        ),
      );
    }
    $dialog_source = preg_replace('/ class="[^"]+"/', '', theme('links', array(
      'links' => $dialog_links,
      'attributes' => array(),
    )));
  }
  $form = array();
  $form['dialog'] = array(
    '#type' => 'fieldset',
    '#title' => t('Dialog examples'),
  );
  $form['dialog']['demo'] = array(
    '#markup' => _jquery_ui_filter_demo_check_markup('dialog', $dialog_source),
  );
  $form['dialog']['dialog_source'] = array(
    '#type' => 'textarea',
    '#title' => t('Dialog source'),
    '#description' => _jquery_ui_filter_dialog_tips_callback(),
    '#default_value' => $dialog_source,
    '#required' => TRUE,
  );
  return $form;
}