本文整理汇总了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');
}
}
示例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]);
}
}
示例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');
}
}
}
示例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');
}
示例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');
}
示例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();
}
示例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');
}
示例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');
}
示例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');
}
示例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');
}
示例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');
}
示例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();
}
示例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');
}
示例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()));
}
示例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>');
}