Same name in other branches
- 5.0.x src/Form/InfoForm.php \Drupal\advagg\Form\InfoForm::buildForm()
- 6.0.x src/Form/InfoForm.php \Drupal\advagg\Form\InfoForm::buildForm()
- 8.x-2.x src/Form/InfoForm.php \Drupal\advagg\Form\InfoForm::buildForm()
- 8.x-3.x src/Form/InfoForm.php \Drupal\advagg\Form\InfoForm::buildForm()
Fichier
-
src/
Form/ InfoForm.php, line 94
Classe
- InfoForm
- View AdvAgg information for this site.
Namespace
Drupal\advagg\FormCode
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();
$advagg_hooks = advagg_hooks_implemented();
// 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>',
];
$form['hooks_implemented'] = [
'#type' => 'details',
'#open' => TRUE,
'#title' => $this->t('Core asset hooks implemented by modules'),
];
// Output all advagg hooks implemented.
foreach ($advagg_hooks as $hook => $values) {
if (empty($values)) {
$form['hooks_implemented'][$hook] = [
'#markup' => '<div><strong>' . $hook . ':</strong> 0</div>',
];
}
else {
$form['hooks_implemented'][$hook] = [
'#markup' => '<div><strong>' . $hook . ':</strong> ' . count($values) . $this->formatList($values) . '</div>',
];
}
}
// 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;
}