function AjaxCssForm::buildForm
Same name in other branches
- 8.9.x core/modules/ckeditor/tests/modules/src/Form/AjaxCssForm.php \Drupal\ckeditor_test\Form\AjaxCssForm::buildForm()
Overrides FormInterface::buildForm
File
-
core/
modules/ ckeditor/ tests/ modules/ src/ Form/ AjaxCssForm.php, line 53
Class
- AjaxCssForm
- A form for testing delivery of CSS to CKEditor via AJAX.
Namespace
Drupal\ckeditor_test\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
// Create an inline and iframe CKEditor instance so we can test against
// both.
$form['inline'] = [
'#type' => 'container',
'#attached' => [
'library' => [
'ckeditor_test/ajax_css',
],
],
'#children' => $this->t('Here be dragons.'),
];
$form['iframe'] = [
'#type' => 'text_format',
'#default_value' => $this->t('Here be llamas.'),
];
// A pair of buttons to trigger the AJAX events.
$form['actions'] = [
'css_inline' => [
'#type' => 'submit',
'#value' => $this->t('Add CSS to inline CKEditor instance'),
'#ajax' => [
'callback' => [
$this,
'addCssInline',
],
],
],
'css_frame' => [
'#type' => 'submit',
'#value' => $this->t('Add CSS to iframe CKEditor instance'),
'#ajax' => [
'callback' => [
$this,
'addCssIframe',
],
],
],
'#type' => 'actions',
];
return $form;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.