當前位置: 首頁>>代碼示例>>PHP>>正文


PHP FormStateInterface::setRedirect方法代碼示例

本文整理匯總了PHP中Drupal\Core\Form\FormStateInterface::setRedirect方法的典型用法代碼示例。如果您正苦於以下問題:PHP FormStateInterface::setRedirect方法的具體用法?PHP FormStateInterface::setRedirect怎麽用?PHP FormStateInterface::setRedirect使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Drupal\Core\Form\FormStateInterface的用法示例。


在下文中一共展示了FormStateInterface::setRedirect方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: submitForm

 /**
  * {@inheritdoc}
  */
 public function submitForm(array &$form, FormStateInterface $form_state)
 {
     if ($form_state->getValue('threshold')) {
         $form_state->setRedirect('uc_stock.threshold');
     } else {
         $form_state->setRedirect('uc_stock.settings');
     }
 }
開發者ID:justincletus,項目名稱:webdrupalpro,代碼行數:11,代碼來源:StockReportForm.php

示例2: submitForm

 /**
  * {@inheritdoc}
  */
 public function submitForm(array &$form, FormStateInterface $form_state)
 {
     // Remove Form API elements from $form_state
     $form_state->cleanValues();
     $aid = db_insert('uc_attributes')->fields($form_state->getValues())->execute();
     if ($form_state->getValue('display') == 0) {
         // No options needed/allowed for Textfield display type.
         $form_state->setRedirect('uc_attribute.overview', ['aid' => $aid]);
     } else {
         // All other display types we redirect to add options.
         $form_state->setRedirect('uc_attribute.options', ['aid' => $aid]);
     }
 }
開發者ID:pedrocones,項目名稱:hydrotools,代碼行數:16,代碼來源:AttributeAddForm.php

示例3: submitForm

 /**
  * {@inheritdoc}
  */
 public function submitForm(array &$form, FormStateInterface $form_state)
 {
     $result = $form_state->getValue('fav_sock');
     drupal_set_message($this->t('Your favorite sock is @fav_sock', array('@fav_sock' => $result)));
     if ($result == 'Ankle Biters') {
         $form_state->setRedirect('socks.knee_highs_controller_content');
     } else {
         if ($result == 'Old Fashions') {
             $form_state->setRedirect('socks.old_fashions_controller_content');
         } else {
             $form_state->setRedirect('socks.knee_highs_controller_content');
         }
     }
 }
開發者ID:AllieRays,項目名稱:debugging-drupal-8,代碼行數:17,代碼來源:FavoriteSockForm.php

示例4: submitForm

 /**
  * {@inheritdoc}
  */
 public function submitForm(array &$form, FormStateInterface $form_state)
 {
     $alphabets = $form_state->getValue('alphabet');
     $output = $this->morseConvertToMorse($alphabets);
     drupal_set_message($this->t($output));
     $form_state->setRedirect('morse.morse');
 }
開發者ID:prathamxk,項目名稱:opensource,代碼行數:10,代碼來源:MorseConverter.php

示例5: submitForm

 /**
  * {@inheritdoc}
  */
 public function submitForm(array &$form, FormStateInterface $form_state)
 {
     $list = $form_state->get('list');
     $webhook_actions = $form_state->getValue('webhook_actions');
     $actions = array();
     foreach ($webhook_actions as $webhook_id => $enable) {
         $actions[$webhook_id] = $enable === 1;
     }
     $result = FALSE;
     if (count($actions) > 0) {
         $webhook_url = mailchimp_webhook_url();
         $webhooks = mailchimp_webhook_get($list['id']);
         if (!empty($webhooks)) {
             foreach ($webhooks as $webhook) {
                 if ($webhook['url'] == $webhook_url) {
                     // Delete current webhook.
                     mailchimp_webhook_delete($list['id'], mailchimp_webhook_url());
                 }
             }
         }
         // Add webhook with enabled actions.
         $result = mailchimp_webhook_add($list['id'], mailchimp_webhook_url(), $actions);
     }
     if ($result) {
         drupal_set_message(t('Webhooks for list "%name" have been updated.', array('%name' => $list['name'])));
     } else {
         drupal_set_message(t('Unable to update webhooks for list "%name".', array('%name' => $list['name'])), 'warning');
     }
     $form_state->setRedirect('mailchimp_lists.overview');
 }
開發者ID:rafavergara,項目名稱:ddv8,代碼行數:33,代碼來源:MailchimpListsWebhookSettingsForm.php

示例6: save

 /**
  * {@inheritdoc}
  */
 public function save(array $form, FormStateInterface $form_state)
 {
     $this->entity->save();
     $form_state->setRedirect('entity.' . $this->entity->getEntityTypeId() . '.canonical', array($this->entity->getEntityTypeId() => $this->entity->id()));
     $entity = $this->getEntity();
     $entity->save();
 }
開發者ID:jokas,項目名稱:d8.dev,代碼行數:10,代碼來源:EckEntityForm.php

示例7: submit

 /**
  * {@inheritdoc}
  */
 public function submit(array $form, FormStateInterface $form_state)
 {
     $this->entity->delete();
     drupal_set_message($this->t('Custom block %label has been deleted.', array('%label' => $this->entity->label())));
     $this->logger('block_content')->notice('Custom block %label has been deleted.', array('%label' => $this->entity->label()));
     $form_state->setRedirect('block_content.list');
 }
開發者ID:anatalsceo,項目名稱:en-classe,代碼行數:10,代碼來源:BlockContentDeleteForm.php

示例8: save

 /**
  * {@inheritdoc}
  */
 public function save(array $form, FormStateInterface $form_state) {
   $this->entity->save();
   drupal_set_message($this->t('Saved the %label store type.', [
     '%label' => $this->entity->label(),
   ]));
   $form_state->setRedirect('entity.commerce_store_type.collection');
 }
開發者ID:housineali,項目名稱:drpl8_dv,代碼行數:10,代碼來源:StoreTypeForm.php

示例9: submitForm

 /**
  * {@inheritdoc}
  */
 public function submitForm(array &$form, FormStateInterface $form_state)
 {
     $this->entity->delete();
     drupal_set_message(t('Newsletter %label has been deleted.', array('%label' => $this->entity->label())));
     \Drupal::logger('simplenews')->notice('Newsletter %label has been deleted.', array('%label' => $this->entity->label()));
     $form_state->setRedirect('simplenews.newsletter_list');
 }
開發者ID:aritnath1990,項目名稱:simplenewslatest,代碼行數:10,代碼來源:NewsletterDeleteForm.php

示例10: submitForm

 /**
  * {@inheritdoc}
  */
 public function submitForm(array &$form, FormStateInterface $form_state)
 {
     // Remove Form API elements from $form_state
     $form_state->cleanValues();
     db_merge('uc_attributes')->key(array('aid' => $form_state->getValue('aid')))->fields($form_state->getValues())->execute();
     $form_state->setRedirect('uc_attribute.overview');
 }
開發者ID:pedrocones,項目名稱:hydrotools,代碼行數:10,代碼來源:AttributeEditForm.php

示例11: submitForm

 /**
  *
  */
 public function submitForm(array &$form, FormStateInterface $form_state)
 {
     ini_set('max_execution_time', $this->max_execution);
     $count = $this->deleteAllUsers();
     drupal_set_message($this->t('All users have been deleted. Number of users deleted: !count.', array('!count' => String::checkPlain($count))));
     $form_state->setRedirect('user.admin_account');
 }
開發者ID:blakefrederick,項目名稱:sas-backend,代碼行數:10,代碼來源:DeleteUsersForm.php

示例12: save

 /**
  * {@inheritdoc}
  */
 public function save(array $form, FormStateInterface $form_state)
 {
     $entity = $this->getEntity();
     $redirect = $entity->getEntityType()->get('id');
     $form_state->setRedirect('entity.' . $redirect . '.collection');
     $entity->save();
 }
開發者ID:alexawg2015,項目名稱:drupal-8,代碼行數:10,代碼來源:MyeckForm.php

示例13: submitForm

 /**
  * {@inheritdoc}
  */
 public function submitForm(array &$form, FormStateInterface $form_state)
 {
     XmlSitemapLinkStorage::linkDelete('custom', $this->custom_link['id']);
     drupal_set_message(t('The custom link for %loc has been deleted.', array('%loc' => $this->custom_link['loc'])));
     watchdog('xmlsitemap', 'The custom link for %loc has been deleted.', array('%loc' => $this->custom_link['loc']), WATCHDOG_NOTICE);
     $form_state->setRedirect('xmlsitemap_custom.list');
 }
開發者ID:jeroenos,項目名稱:jeroenos_d8.mypressonline.com,代碼行數:10,代碼來源:XmlSitemapCustomDeleteForm.php

示例14: submitForm

 /**
  * {@inheritdoc}
  */
 public function submitForm(array &$form, FormStateInterface $form_state)
 {
     // Redirect to the "Clear server" confirmation form.
     /** @var \Drupal\search_api\ServerInterface $server */
     $server = $form['#server'];
     $form_state->setRedirect('entity.search_api_server.clear', array('search_api_server' => $server->id()));
 }
開發者ID:curveagency,項目名稱:intranet,代碼行數:10,代碼來源:ServerStatusForm.php

示例15: submitForm

 /**
  * {@inheritdoc}
  */
 public function submitForm(array &$form, FormStateInterface $form_state)
 {
     $this->getEntity()->delete();
     $this->logger->info('Payment #@payment_id has been deleted.', ['@payment_id' => $this->getEntity()->id()]);
     drupal_set_message($this->t('Payment #@payment_id has been deleted.', array('@payment_id' => $this->getEntity()->id())));
     $form_state->setRedirect('<front>');
 }
開發者ID:nishantkumar155,項目名稱:drupal8.crackle,代碼行數:10,代碼來源:PaymentDeleteForm.php


注:本文中的Drupal\Core\Form\FormStateInterface::setRedirect方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。