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/views_ui/src/Form/ |
Upload File : |
<?php namespace Drupal\views_ui\Form; use Drupal\Core\Entity\EntityConfirmFormBase; use Drupal\Core\Entity\EntityManagerInterface; use Drupal\Core\Form\FormStateInterface; use Drupal\user\SharedTempStoreFactory; use Symfony\Component\DependencyInjection\ContainerInterface; /** * Builds the form to break the lock of an edited view. */ class BreakLockForm extends EntityConfirmFormBase { /** * Stores the Entity manager. * * @var \Drupal\Core\Entity\EntityManagerInterface */ protected $entityManager; /** * Stores the user tempstore. * * @var \Drupal\user\SharedTempStore */ protected $tempStore; /** * Constructs a \Drupal\views_ui\Form\BreakLockForm object. * * @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager * The Entity manager. * @param \Drupal\user\SharedTempStoreFactory $temp_store_factory * The factory for the temp store object. */ public function __construct(EntityManagerInterface $entity_manager, SharedTempStoreFactory $temp_store_factory) { $this->entityManager = $entity_manager; $this->tempStore = $temp_store_factory->get('views'); } /** * {@inheritdoc} */ public static function create(ContainerInterface $container) { return new static( $container->get('entity.manager'), $container->get('user.shared_tempstore') ); } /** * {@inheritdoc} */ public function getFormId() { return 'views_ui_break_lock_confirm'; } /** * {@inheritdoc} */ public function getQuestion() { return $this->t('Do you want to break the lock on view %name?', ['%name' => $this->entity->id()]); } /** * {@inheritdoc} */ public function getDescription() { $locked = $this->tempStore->getMetadata($this->entity->id()); $account = $this->entityManager->getStorage('user')->load($locked->owner); $username = [ '#theme' => 'username', '#account' => $account, ]; return $this->t('By breaking this lock, any unsaved changes made by @user will be lost.', ['@user' => drupal_render($username)]); } /** * {@inheritdoc} */ public function getCancelUrl() { return $this->entity->urlInfo('edit-form'); } /** * {@inheritdoc} */ public function getConfirmText() { return $this->t('Break lock'); } /** * {@inheritdoc} */ public function buildForm(array $form, FormStateInterface $form_state) { if (!$this->tempStore->getMetadata($this->entity->id())) { $form['message']['#markup'] = $this->t('There is no lock on view %name to break.', ['%name' => $this->entity->id()]); return $form; } return parent::buildForm($form, $form_state); } /** * {@inheritdoc} */ public function submitForm(array &$form, FormStateInterface $form_state) { $this->tempStore->delete($this->entity->id()); $form_state->setRedirectUrl($this->entity->urlInfo('edit-form')); drupal_set_message($this->t('The lock has been broken and you may now edit this view.')); } }