本文整理汇总了PHP中Drupal\Core\Form\ConfirmFormBase::buildForm方法的典型用法代码示例。如果您正苦于以下问题:PHP ConfirmFormBase::buildForm方法的具体用法?PHP ConfirmFormBase::buildForm怎么用?PHP ConfirmFormBase::buildForm使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Drupal\Core\Form\ConfirmFormBase
的用法示例。
在下文中一共展示了ConfirmFormBase::buildForm方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildForm
/**
* {@inheritdoc}
*/
public function buildForm(array $form, FormStateInterface $form_state, $tempstore_id = NULL, $machine_name = NULL, $context_id = NULL)
{
$this->tempstore_id = $tempstore_id;
$this->machine_name = $machine_name;
$this->context_id = $context_id;
return parent::buildForm($form, $form_state);
}
示例2: buildForm
/**
* {@inheritdoc}
*/
public function buildForm(array $form, FormStateInterface $form_state, NodeInterface $node = NULL, $fid = NULL, $pfid = NULL)
{
$this->node = $node;
$this->featureId = $fid;
$this->feature = uc_product_feature_load($pfid);
return parent::buildForm($form, $form_state);
}
示例3: buildForm
/**
* {@inheritdoc}
*/
public function buildForm(array $form, FormStateInterface $form_state, $actions = NULL)
{
$cart_links_config = $this->config('uc_cart_links.settings');
$this->actions = $actions;
// Fail if the link is restricted.
$data = $cart_links_config->get('restrictions');
if (!empty($data)) {
$restrictions = explode("\n", $cart_links_config->get('restrictions'));
$restrictions = array_map('trim', $restrictions);
if (!empty($restrictions) && !in_array($this->actions, $restrictions)) {
unset($_GET['destination']);
$path = $cart_links_config->get('invalid_page');
if (empty($path)) {
return $this->redirect('<front>', [], ['absolute' => TRUE]);
}
return new RedirectResponse(Url::fromUri('internal:/' . $path, ['absolute' => TRUE])->toString());
}
}
// Confirm with the user if the form contains a destructive action.
$cart = Cart::create(\Drupal::getContainer());
$items = $cart->getContents();
if ($cart_links_config->get('empty') && !empty($items)) {
$actions = explode('-', urldecode($this->actions));
foreach ($actions as $action) {
$action = Unicode::substr($action, 0, 1);
if ($action == 'e' || $action == 'E') {
$form = parent::buildForm($form, $form_state);
$form['actions']['cancel']['#href'] = $cart_links_config->get('invalid_page');
return $form;
}
}
}
// No destructive actions, so process the link immediately.
return $this->submitForm($form, $form_state);
}
示例4: buildForm
/**
* {@inheritdoc}
*
* @param string $ban_id
* The IP address record ID to unban.
*/
public function buildForm(array $form, FormStateInterface $form_state, $ban_id = '')
{
if (!($this->banIp = $this->ipManager->findById($ban_id))) {
throw new NotFoundHttpException();
}
return parent::buildForm($form, $form_state);
}
示例5: buildForm
/**
* {@inheritdoc}
*/
public function buildForm(array $form, FormStateInterface $form_state)
{
$results = $_POST;
$form['method'] = array('#type' => 'hidden', '#value' => $results['method']);
if (!isset($results['reset'])) {
$results['reset'] = 0;
}
$form['all'] = array('#type' => 'hidden', '#value' => $results['all']);
if (isset($results['all'])) {
// Only carry reset value through if delete all nodes is set
$form['reset'] = array('#type' => 'hidden', '#value' => $results['reset']);
$form['all_warning'] = array('#markup' => '<p>' . $this->t('All content in all content types will be deleted. Be sure to have a backup of any important data!') . '</p>');
if (!empty($results['reset'])) {
if ($results['all']) {
$form['all_reset'] = array('#markup' => '<p>' . $this->t('Node, revision and comment counts will be reset.') . '</p>');
}
}
} elseif (isset($results['types'])) {
if (is_array($results['types'])) {
foreach ($results['types'] as $key_type => $type) {
/**
* @TODO, if we use the form array the value doesn't exist in the submit
*/
$_SESSION['nodes_type'][$key_type] = $type;
$info = node_type_get_types('type', $type);
$info = $info[$type];
$form[$type . '_warning'] = array('#markup' => '<p>' . $this->t('All content in the %type content type will be deleted. Be sure to have a backup of any important data!', array('%type' => $info->get('name'))) . '</p>');
}
}
if ($results['reset']) {
$form['all_reset'] = array('#markup' => '<p>' . $this->t('Sorry, we can\'t reset the counters because you are not deleting all nodes.') . '</p>');
}
}
return parent::buildForm($form, $form_state);
}
示例6: buildForm
/**
* {@inheritdoc}
*/
public function buildForm(array $form, FormStateInterface $form_state, NodeInterface $node = NULL, $component = NULL)
{
$this->node = $node;
// @todo $component should be a fully loaded object, need to make our own ParamConverterInterface.
$this->component = isset($node->webform['components'][$component]) ? $node->webform['components'][$component] : FALSE;
return parent::buildForm($form, $form_state);
}
示例7: buildForm
/**
* {@inheritdoc}
*/
public function buildForm(array $form, FormStateInterface $form_state, PageInterface $page = NULL, $display_variant_id = NULL, $condition_id = NULL)
{
$this->page = $page;
$this->displayVariant = $this->page->getVariant($display_variant_id);
$this->selectionCondition = $this->displayVariant->getSelectionCondition($condition_id);
return parent::buildForm($form, $form_state);
}
示例8: buildForm
/**
* Request new hash form.
*
* @param $key
* The mail key to be sent.
* @param $context
* Necessary context to send the mail. Must at least include the simplenews
* subscriber.
*/
public function buildForm(array $form, FormStateInterface $form_state, $key = '', $context = array())
{
$form = parent::buildForm($form, $form_state);
$form_state->set('key', $key);
$form_state->set('context', $context);
return $form;
}
示例9: buildForm
/**
* {@inheritdoc}
*/
public function buildForm(array $form, FormStateInterface $form_state, PageInterface $page = NULL, $display_variant_id = NULL, $block_id = NULL)
{
$this->page = $page;
$this->displayVariant = $this->page->getVariant($display_variant_id);
$this->block = $this->displayVariant->getBlock($block_id);
return parent::buildForm($form, $form_state);
}
示例10: buildForm
/**
* Builds the form array.
*
* Note that when adding arguments to buildForm(), you need to give
* them default values, to avoid PHP errors.
*/
public function buildForm(array $form, FormStateInterface $form_state, $id = '')
{
// Sanitize and save the ID.
$id = (int) $id;
$this->to_delete_id = $id;
$form = parent::buildForm($form, $form_state);
return $form;
}
示例11: buildForm
/**
* {@inheritdoc}
*/
public function buildForm(array $form, array &$form_state, $browser_langcode = NULL)
{
$this->browserLangcode = $browser_langcode;
$form = parent::buildForm($form, $form_state);
// @todo Convert to getCancelRoute() after http://drupal.org/node/2082071.
$form['actions']['cancel']['#href'] = 'admin/config/regional/language/detection/browser';
return $form;
}
示例12: buildForm
/**
* {@inheritdoc}
*/
public function buildForm(array $form, FormStateInterface $form_state,
FlagInterface $flag = NULL, $entity_id = NULL) {
$this->flag = $flag;
$flag_service = \Drupal::service('flag');
$this->entity = $flag_service->getFlaggableById($this->flag, $entity_id);
return parent::buildForm($form, $form_state);
}
示例13: buildForm
/**
* {@inheritdoc}
*/
public function buildForm(array $form, FormStateInterface $form_state, $mail = '', NewsletterInterface $newsletter = NULL)
{
$form = parent::buildForm($form, $form_state);
$form['question'] = array('#markup' => '<p>' . t('Are you sure you want to add %user to the %newsletter mailing list?', array('%user' => simplenews_mask_mail($mail), '%newsletter' => $newsletter->name)) . "<p>\n");
$form['mail'] = array('#type' => 'value', '#value' => $mail);
$form['newsletter'] = array('#type' => 'value', '#value' => $newsletter);
return $form;
}
示例14: buildForm
/**
* Overrides \Drupal\Core\Form\ConfirmFormBase::buildForm().
*/
public function buildForm(array $form, array &$form_state, $pid = NULL)
{
$this->pathAlias = $this->aliasStorage->load(array('pid' => $pid));
$form = parent::buildForm($form, $form_state);
// @todo Convert to getCancelRoute() after http://drupal.org/node/1987802.
$form['actions']['cancel']['#href'] = 'admin/config/search/path';
return $form;
}
示例15: buildForm
/**
* {@inheritdoc}
*/
public function buildForm(array $form, FormStateInterface $form_state, OrderInterface $uc_order = NULL, $payment = NULL)
{
$this->payment = uc_payment_load($payment);
// Make sure the payment is for the specified order.
if ($this->payment->order_id != $uc_order->id()) {
throw new NotFoundHttpException();
}
return parent::buildForm($form, $form_state);
}