function advagg_validator_admin_form_generator

cis7 advagg_validator.admin.inc advagg_validator_admin_form_generator($type, $run_client_side)
cle7 advagg_validator.admin.inc advagg_validator_admin_form_generator($type, $run_client_side)
elmsmedia7 advagg_validator.admin.inc advagg_validator_admin_form_generator($type, $run_client_side)
icor7 advagg_validator.admin.inc advagg_validator_admin_form_generator($type, $run_client_side)
meedjum_blog7 advagg_validator.admin.inc advagg_validator_admin_form_generator($type, $run_client_side)
mooc7 advagg_validator.admin.inc advagg_validator_admin_form_generator($type, $run_client_side)

Scan the file system and build a form tree from it.

Parameters

string $type: css or js

bool $run_client_side: Set to TRUE to run the checking code client side.

Return value

array form array.

3 calls to advagg_validator_admin_form_generator()
advagg_validator_admin_css_lint_form in sites/all/modules/ulmus/advagg/advagg_validator/advagg_validator.admin.inc
Form builder; CSS validator via csslint.
advagg_validator_admin_css_w3_form in sites/all/modules/ulmus/advagg/advagg_validator/advagg_validator.admin.inc
Form builder; CSS validator via w3.
advagg_validator_admin_js_hint_form in sites/all/modules/ulmus/advagg/advagg_validator/advagg_validator.admin.inc
Form builder; CSS validator via jshint.

File

sites/all/modules/ulmus/advagg/advagg_validator/advagg_validator.admin.inc, line 115
Admin page callbacks for the advagg validator module.

Code

function advagg_validator_admin_form_generator($type, $run_client_side) {
  $form = array();
  module_load_include('inc', 'advagg_validator', 'advagg_validator');

  $files = advagg_validator_scan_all_dirs($type);
  rsort($files);
  foreach ($files as $file) {
    $dir = dirname($file);

    // Build the direcotry structure.
    $levels = explode('/', $dir == '.' ? '{ROOT}' : $dir);
    $point = &$form;
    $built = array();
    foreach ($levels as $key => $value) {
      // Build direcotry structure,
      $built[] = $value;
      $point = &$point[$value];
      if (!is_array($point)) {
        $form_api_dirname = str_replace(array('/', '.'), array('__', '--'), $dir);
        $wrapper = 'advagg-validator-' . $type . '-validator-ajax' . $form_api_dirname;

        $point = array(
          '#type' => 'fieldset',
          '#title' => check_plain($value),
          '#description' => '<strong>' . t('Directory:') . ' </strong>' . check_plain(implode('/', $built)),
          '#collapsible' => TRUE,
          '#collapsed' => TRUE,
          '#weight' => 100,
        );
        if (!isset($point['check_all_levels']) && $value != '{ROOT}') {
          $point['check_all_levels'] = array(
            '#type' => 'submit',
            '#value' => t('Check this Directory and all Subdirectories: @dirname', array('@dirname' => implode('/', $built))),
          );
          if (!$run_client_side) {
            $point['check_all_levels'] += array(
              '#submit' => array('advagg_validator_admin_test_advagg_' . $type . '_subdirectory_submit'),
              '#ajax' => array(
                'callback' => 'advagg_validator_admin_test_advagg_' . $type . '_subdirectory_callback',
                'wrapper' => $wrapper,
              ),
            );
          }
          else {
            $point['check_all_levels'] += array(
              '#attributes' => array(
                'class' => array('advagg_validator_recursive_' . $type),
              ),
            );
          }
        }
        $point['break'] = array(
          '#markup' => '<div></div>',
        );

        $point['wrapper'] = array(
          '#markup' => "<div id='" . $wrapper . "' class='results'></div>",
          '#weight' => 90,
        );
      }

      // Drop in button and info if we reached the point where a file lives.
      if (count($levels) == $key + 1) {
        $form_api_filename = str_replace(array('/', '.'), array('__', '--'), $file);

        if (!isset($point['check_this_level'])) {
          $point['check_this_level'] = array(
            '#type' => 'submit',
            '#value' => t('Check this Directory: @dirname', array('@dirname' => $dir)),
          );
          if (!$run_client_side) {
            $point['check_this_level'] += array(
              '#submit' => array('advagg_validator_admin_test_advagg_' . $type . '_directory_submit'),
              '#ajax' => array(
                'callback' => 'advagg_validator_admin_test_advagg_' . $type . '_directory_callback',
                'wrapper' => $wrapper,
              ),
            );
          }
          else {
            $point['check_this_level'] += array(
              '#attributes' => array(
                'class' => array('advagg_validator_' . $type),
              ),
            );
          }
        }
        if (!isset($point['start'])) {
          $point['start'] = array(
            '#markup' => '<br /><strong>' . t('File:') . ' </strong><div class="filenames">',
          );
        }
        else {
          $point['start'] = array(
            '#markup' => '<br /><strong>' . t('Files:') . ' </strong><div class="filenames">',
          );
        }
        $point[$form_api_filename] = array(
          '#markup' => check_plain($file) . ' ',
        );
        if (!isset($point['end'])) {
          $point['end'] = array(
            '#markup' => '</div>',
          );
        }

        $point['hidden_' . $form_api_filename] = array(
          '#type' => 'hidden',
          '#value' => $file,
          '#attributes' => array(
            'class' => array('filenames'),
          ),
        );

      }
    }
  }
  return $form;
}
Error | ELMSLN API

Error

×

Error message

  • Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/elmsln_community/api.elmsln.org/includes/common.inc:2791) in drupal_send_headers() (line 1499 of /var/www/html/elmsln_community/api.elmsln.org/includes/bootstrap.inc).
  • Error: Call to undefined function apc_delete() in DrupalAPCCache->clear() (line 289 of /var/www/html/elmsln_community/api.elmsln.org/sites/all/modules/apc/drupal_apc_cache.inc).
The website encountered an unexpected error. Please try again later.