作者:alnutil
项目:drunatr
/**
* 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;
}
作者:justincletu
项目:webdrupalpr
/**
* {@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);
}
作者:pulibrar
项目:reca
/**
* {@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);
}
作者:pulibrar
项目:reca
/**
* {@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);
}
作者:blakefrederic
项目:sas-backen
/**
* {@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);
}
作者:Progressabl
项目:openway
/**
* {@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);
}
作者:Progressabl
项目:openway
/**
* {@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);
}
作者:pedrocone
项目:hydrotool
/**
* {@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);
}
作者:papillon-cendr
项目:d
/**
* {@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);
}
作者:alnutil
项目:drunatr
/**
* {@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;
}
作者:Jamesadama
项目:programmers_guide_to_drupa
/**
* 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;
}
作者:AshishNaik02
项目:iimisac-d
/**
* {@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);
}
作者:AshishNaik02
项目:iimisac-d
/**
* {@inheritdoc}
*
* @param int $id
* (optional) The ID of the item to be deleted.
*/
public function buildForm(array $form, FormStateInterface $form_state, $file = '') {
// @todo update access!
$this->id = $file;
if (!$this->id) {
throw new NotFoundHttpException();
}
// @todo set album type?
return parent::buildForm($form, $form_state);
}
作者:pedrocone
项目:hydrotool
/**
* {@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);
}
作者:eloi
项目:botafoc.ca
/**
* {@inheritdoc}
*/
public function buildForm(array $form, FormStateInterface $form_state, ProfileInterface $linkit_profile = NULL, $plugin_instance_id = NULL) {
$this->linkitProfile = $linkit_profile;
if (!$this->linkitProfile->getAttributes()->has($plugin_instance_id)) {
throw new NotFoundHttpException();
}
$this->linkitAttribute = $this->linkitProfile->getAttribute($plugin_instance_id);
return parent::buildForm($form, $form_state);
}
作者:r-daneeloliva
项目:chal
/**
* @param array $form
* @param \Drupal\Core\Form\FormStateInterface $form_state
* @param null $backup_migrate_destination
* @param null $backup_id
* @return array
*/
public function buildForm(array $form, FormStateInterface $form_state, $backup_migrate_destination = NULL, $backup_id = NULL)
{
$this->destination = $backup_migrate_destination;
$this->backup_id = $backup_id;
$bam = backup_migrate_get_service_object();
$form['source_id'] = DrupalConfigHelper::getPluginSelector($bam->sources(), $this->t('Restore To'));
$conf_schema = $bam->plugins()->map('configSchema', array('operation' => 'restore'));
$form += DrupalConfigHelper::buildFormFromSchema($conf_schema, $bam->plugins()->config());
return parent::buildForm($form, $form_state);
}
作者:oddhil
项目:entity_layou
/**
* {@inheritdoc}
*/
public function buildForm(array $form, FormStateInterface $form_state)
{
$form = parent::buildForm($form, $form_state);
// Remove the cancel button if this is an AJAX request since Drupals built
// in modal dialogues does not handle buttons that are not a primary
// button very well.
if ($this->getRequest()->isXmlHttpRequest()) {
unset($form['actions']['cancel']);
}
return $form;
}
作者:justincletu
项目:webdrupalpr
/**
* {@inheritdoc}
*/
public function buildForm(array $form, FormStateInterface $form_state, $user = NULL, $role = NULL)
{
$expiration = db_query('SELECT expiration FROM {uc_roles_expirations} WHERE uid = :uid AND rid = :rid', [':uid' => $user->id(), ':rid' => $role])->fetchField();
if ($expiration) {
$role_name = _uc_role_get_name($role);
$form['user'] = array('#type' => 'value', '#value' => $user->getUsername());
$form['uid'] = array('#type' => 'value', '#value' => $user->id());
$form['role'] = array('#type' => 'value', '#value' => $role_name);
$form['rid'] = array('#type' => 'value', '#value' => $role);
}
return parent::buildForm($form, $form_state);
}
作者:andypos
项目:layou
/**
* {@inheritdoc}
*/
public function buildForm(array $form, array &$form_state, PageInterface $page = NULL, $page_variant_id = NULL, $layout_region_id = NULL, $block_id = NULL)
{
$this->page = $page;
$this->displayVariant = $this->page->getVariant($page_variant_id);
$this->displayVariant->init($this->page->getExecutable());
$this->block = $this->displayVariant->getBlock($block_id);
$form = parent::buildForm($form, $form_state, $page, $page_variant_id, $layout_region_id, $block_id);
if ($this->getRequest()->isXmlHttpRequest()) {
$form['actions']['submit']['#ajax'] = array('callback' => array($this, 'submitForm'));
}
return $form;
}
作者:frankc
项目:sftw
public function buildForm(array $form, FormStateInterface $form_state, $field_group_name = NULL, $entity_type_id = NULL, $bundle = NULL, $context = NULL)
{
if ($context == 'form') {
$mode = $this->getRequest()->attributes->get('form_mode_name');
} else {
$mode = $this->getRequest()->attributes->get('view_mode_name');
}
if (empty($mode)) {
$mode = 'default';
}
$this->fieldGroup = field_group_load_field_group($field_group_name, $entity_type_id, $bundle, $context, $mode);
return parent::buildForm($form, $form_state);
}