theme_fieldset_helper_toggle_all

contrib-jrockowitz/fieldset_helper/fieldset_helper.module, line 253

Versions
6
theme_fieldset_helper_toggle_all($selector = NULL, $id = NULL)

Theme 'Expand all | Collapse all' links that toggle a page or selected fieldsets state.

Parameters

$selector A jQuery selector that restricts what fieldset will be toggle by link.

Return value

Html output

Code

<?php
function theme_fieldset_helper_toggle_all($selector = NULL, $id = NULL) {
  if (!user_access('save fieldset state')) {
    return '';
  }

  // Wrap selector string in single quotes
  if ($selector != NULL) {
    $selector = "'". $selector ."'";
  }

  $output = '';
  $output .= '<div class="fieldset-helper-toggle-all"'. (($id != NULL)?' id="'. $id .'"':'') .'>';
  $output .= '<a href="javascript:Drupal.FieldsetHelper.expandFieldsets('. $selector .');">'. t('Expand all') .'</a>';
  $output .= ' | ';
  $output .= '<a href="javascript:Drupal.FieldsetHelper.collapseFieldsets('. $selector .');">'. t('Collapse all') .'</a>';
  $output .= '</div>';
  return $output;
}
?>