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/shortcut/src/ |
Upload File : |
<?php namespace Drupal\shortcut; use Drupal\Core\Entity\BundleEntityFormBase; use Drupal\Core\Form\FormStateInterface; /** * Form handler for the shortcut set entity edit forms. */ class ShortcutSetForm extends BundleEntityFormBase { /** * {@inheritdoc} */ public function form(array $form, FormStateInterface $form_state) { $form = parent::form($form, $form_state); $entity = $this->entity; $form['label'] = [ '#type' => 'textfield', '#title' => t('Set name'), '#description' => t('The new set is created by copying items from your default shortcut set.'), '#required' => TRUE, '#default_value' => $entity->label(), ]; $form['id'] = [ '#type' => 'machine_name', '#machine_name' => [ 'exists' => '\Drupal\shortcut\Entity\ShortcutSet::load', 'source' => ['label'], 'replace_pattern' => '[^a-z0-9-]+', 'replace' => '-', ], '#default_value' => $entity->id(), // This id could be used for menu name. '#maxlength' => 23, ]; $form['actions']['submit']['#value'] = t('Create new set'); return $this->protectBundleIdElement($form); } /** * {@inheritdoc} */ public function save(array $form, FormStateInterface $form_state) { $entity = $this->entity; $is_new = !$entity->getOriginalId(); $entity->save(); if ($is_new) { drupal_set_message(t('The %set_name shortcut set has been created. You can edit it from this page.', ['%set_name' => $entity->label()])); } else { drupal_set_message(t('Updated set name to %set-name.', ['%set-name' => $entity->label()])); } $form_state->setRedirectUrl($this->entity->urlInfo('customize-form')); } }