当前位置: 首页>>代码示例>>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;未经允许,请勿转载。