Same name and namespace in other branches
  1. 5.0.x src/Form/InfoForm.php \Drupal\advagg\Form\InfoForm::buildForm() 1 commentaire
  2. 8.x-2.x src/Form/InfoForm.php \Drupal\advagg\Form\InfoForm::buildForm() 1 commentaire
  3. 8.x-3.x src/Form/InfoForm.php \Drupal\advagg\Form\InfoForm::buildForm() 1 commentaire
  4. 8.x-4.x src/Form/InfoForm.php \Drupal\advagg\Form\InfoForm::buildForm() 1 commentaire

Fichier

src/Form/InfoForm.php, line 94

Classe

InfoForm
View AdvAgg information for this site.

Namespace

Drupal\advagg\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
    $form['tip'] = [
        '#markup' => '<p>' . $this->t('This page provides debugging information. There are no configuration options here.') . '</p>',
    ];
    // Get all hooks and variables.
    $core_hooks = $this->themeRegistry
        ->get();
    // Output html preprocess functions hooks.
    $form['theme_info'] = [
        '#type' => 'details',
        '#open' => TRUE,
        '#title' => $this->t('Hook Theme Info'),
    ];
    $data = implode("\n", $core_hooks['html']['preprocess functions']);
    $form['theme_info']['advagg_theme_info'] = [
        '#markup' => '<p>preprocess functions on html.</p><pre>' . $data . '</pre>',
    ];
    // Get info about a file.
    $form['get_info_about_agg'] = [
        '#type' => 'details',
        '#open' => TRUE,
        '#title' => $this->t('Get detailed info about an optimized file'),
    ];
    $form['get_info_about_agg']['filename'] = [
        '#type' => 'textfield',
        '#size' => 170,
        '#maxlength' => 256,
        '#default_value' => '',
        '#title' => $this->t('Filename'),
    ];
    $form['get_info_about_agg']['submit'] = [
        '#type' => 'submit',
        '#value' => $this->t('Lookup Details'),
        '#submit' => [
            '::getFileInfoSubmit',
        ],
        '#validate' => [
            '::getFileInfoValidate',
        ],
        '#ajax' => [
            'callback' => '::getFileInfoAjax',
            'wrapper' => 'advagg-file-info-ajax',
            'effect' => 'fade',
        ],
    ];
    if ($tip = $this->getRandomFile()) {
        $form['get_info_about_agg']['tip'] = [
            '#markup' => '<p>' . $this->t('Input an optimized filename like "@css_file".', [
                '@css_file' => $tip,
            ]) . '</p>',
        ];
    }
    $form['get_info_about_agg']['wrapper'] = [
        '#prefix' => "<div id='advagg-file-info-ajax'>",
        '#suffix' => "</div>",
    ];
    $form = parent::buildForm($form, $form_state);
    unset($form['actions']);
    return $form;
}