当前位置: 首页>>代码示例>>PHP>>正文


PHP EntityForm::submitForm方法代码示例

本文整理汇总了PHP中Drupal\Core\Entity\EntityForm::submitForm方法的典型用法代码示例。如果您正苦于以下问题:PHP EntityForm::submitForm方法的具体用法?PHP EntityForm::submitForm怎么用?PHP EntityForm::submitForm使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Drupal\Core\Entity\EntityForm的用法示例。


在下文中一共展示了EntityForm::submitForm方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: submitForm

 /**
  * {@inheritdoc}
  */
 public function submitForm(array &$form, FormStateInterface $form_state)
 {
     if ($form_state->getTriggeringElement()['#name'] == 'select_id_submit') {
         $form_state->set('default_type', $form_state->getValue('id'));
         $form_state->setRebuild();
     } else {
         parent::submitForm($form, $form_state);
     }
 }
开发者ID:eric-shell,项目名称:eric-shell-d8,代码行数:12,代码来源:MetatagDefaultsForm.php

示例2: submitForm

 /**
  * {@inheritdoc}
  */
 public function submitForm(array &$form, FormStateInterface $form_state)
 {
     // Get an array of strings with the permissions names.
     $permissions = array_keys(array_filter($form_state->getValue('permissions')));
     $form_state->setValue('permissions', $permissions);
     parent::submitForm($form, $form_state);
 }
开发者ID:mosswoodcreative,项目名称:d8-api-test,代码行数:10,代码来源:AccessTokenResourceForm.php

示例3: submitForm

 /**
  * {@inheritdoc}
  */
 public function submitForm(array &$form, FormStateInterface $form_state)
 {
     $plugin = $this->manager->createInstance($form_state->getValue('key_provider'), []);
     $plugin->submitConfigurationForm($form, $form_state);
     $form_state->setValue('key_provider_settings', $plugin->getConfiguration());
     parent::submitForm($form, $form_state);
 }
开发者ID:rlhawk,项目名称:key,代码行数:10,代码来源:KeyForm.php

示例4: submitForm

 /**
  * {@inheritdoc}
  */
 public function submitForm(array &$form, FormStateInterface $form_state)
 {
     parent::submitForm($form, $form_state);
     $target_entity = $form_state->getValue('entity');
     $target_bundle = $form_state->getValue('bundle', $target_entity);
     $this->entity->set('target_entity_type', $target_entity);
     $this->entity->set('target_bundle', $target_bundle);
     if ($target_entity !== $target_bundle) {
         drupal_set_message($this->t('A entity layout for the @entity entity and @bundle bundle has been created.', ['@entity' => $this->entityLayoutService->getTargetEntityLabel($this->entity), '@bundle' => $this->entityLayoutService->getTargetBundleLabel($this->entity)]));
     } else {
         drupal_set_message($this->t('A entity layout for the @entity entity has been created.', ['@entity' => $this->entityLayoutService->getTargetEntityLabel($this->entity)]));
     }
     $form_state->setRedirectUrl($this->entity->toUrl('collection'));
 }
开发者ID:oddhill,项目名称:entity_layout,代码行数:17,代码来源:EntityLayoutAddForm.php

示例5: submitForm

 /**
  * {@inheritdoc}
  */
 public function submitForm(array &$form, FormStateInterface $form_state)
 {
     parent::submitForm($form, $form_state);
     $facet_source = $this->getEntity();
     drupal_set_message($this->t('Facet source %name has been saved.', ['%name' => $facet_source->label()]));
     $form_state->setRedirect('facets.overview');
 }
开发者ID:nB-MDSO,项目名称:mdso-d8blog,代码行数:10,代码来源:FacetSourceEditForm.php

示例6: submitForm

 /**
  * {@inheritdoc}
  */
 public function submitForm(array &$form, FormStateInterface $form_state)
 {
     // Allow the variant to submit the form.
     $variant_plugin_values = (new FormState())->setValues($form_state->getValue('variant_settings'));
     $this->getVariantPlugin()->submitConfigurationForm($form, $variant_plugin_values);
     // Make sure the Panels storage is set correctly before saving.
     $this->setPanelsStorage($this->getVariantPlugin());
     // Update the original form values.
     $form_state->setValue('variant_settings', $variant_plugin_values->getValues());
     parent::submitForm($form, $form_state);
 }
开发者ID:ns-oxit-study,项目名称:drupal-8-training,代码行数:14,代码来源:PageVariantFormBase.php

示例7: submitForm

 /**
  * {@inheritdoc}
  */
 public function submitForm(array &$form, FormStateInterface $form_state)
 {
     parent::submitForm($form, $form_state);
     // Handle the default value.
     $default_value = array();
     if (isset($form['default_value'])) {
         $items = $form['#entity']->get($this->entity->getName());
         $default_value = $items->defaultValuesFormSubmit($form['default_value'], $form, $form_state);
     }
     $this->entity->default_value = $default_value;
 }
开发者ID:brstde,项目名称:gap1,代码行数:14,代码来源:FieldConfigEditForm.php

示例8: submitForm

 /**
  * {@inheritdoc}
  */
 public function submitForm(array &$form, FormStateInterface $form_state)
 {
     parent::submitForm($form, $form_state);
     if (!$this->entity->isNew() || $this->entity->isLocked()) {
         $this->submitOverviewForm($form, $form_state);
     }
 }
开发者ID:eigentor,项目名称:tommiblog,代码行数:10,代码来源:MenuForm.php

示例9: submitForm

 /**
  * {@inheritdoc}
  */
 public function submitForm(array &$form, FormStateInterface $form_state)
 {
     parent::submitForm($form, $form_state);
     /** @var $index \Drupal\search_api\IndexInterface */
     $index = $this->getEntity();
     $index->setOptions($form_state->getValue('options', array()) + $this->originalEntity->getOptions());
     $datasources = $form_state->getValue('datasources', array());
     /** @var \Drupal\search_api\Datasource\DatasourceInterface[] $datasource_plugins */
     $datasource_plugins = $this->originalEntity->getDatasources(FALSE);
     $datasource_configuration = array();
     foreach ($datasources as $datasource_id) {
         $datasource = $datasource_plugins[$datasource_id];
         $datasource_form = !empty($form['datasource_configs'][$datasource_id]) ? $form['datasource_configs'][$datasource_id] : array();
         $datasource_form_state = new SubFormState($form_state, array('datasource_configs', $datasource_id));
         $datasource->submitConfigurationForm($datasource_form, $datasource_form_state);
         $datasource_configuration[$datasource_id] = $datasource->getConfiguration();
     }
     $index->set('datasource_configs', $datasource_configuration);
     // Call submitConfigurationForm() for the (possibly new) tracker.
     // @todo It seems if we change the tracker, we would validate/submit the old
     //   tracker's form using the new tracker. Shouldn't be done, of course.
     //   Similar above for datasources, though there of course the values will
     //   just always be empty (because datasources have their plugin ID in the
     //   form structure).
     $tracker_id = $form_state->getValue('tracker', NULL);
     if ($this->originalEntity->getTrackerId() == $tracker_id) {
         $tracker = $this->originalEntity->getTracker();
     } else {
         $tracker = $this->trackerPluginManager->createInstance($tracker_id, array('index' => $this->originalEntity));
     }
     $tracker_form_state = new SubFormState($form_state, array('tracker_config'));
     $tracker->submitConfigurationForm($form['tracker_config'], $tracker_form_state);
     $index->set('tracker_config', $tracker->getConfiguration());
     // Invalidate caches, so this gets picked up by the views wizard.
     Cache::invalidateTags(array('views_data'));
     // Remove this line when https://www.drupal.org/node/2370365 gets fixed.
     Cache::invalidateTags(array('extension:views'));
 }
开发者ID:alexku,项目名称:travisintegrationtest,代码行数:41,代码来源:IndexForm.php

示例10: submitForm

 /**
  * {@inheritdoc}
  */
 public function submitForm(array &$form, FormStateInterface $form_state)
 {
     parent::submitForm($form, $form_state);
     // Add the submitted form values to the text format, and save it.
     $format = $this->entity;
     foreach ($form_state->getValues() as $key => $value) {
         if ($key != 'filters') {
             $format->set($key, $value);
         } else {
             foreach ($value as $instance_id => $config) {
                 $format->setFilterConfig($instance_id, $config);
             }
         }
     }
     $format->save();
     // Save user permissions.
     if ($permission = $format->getPermissionName()) {
         foreach ($form_state->getValue('roles') as $rid => $enabled) {
             user_role_change_permissions($rid, array($permission => $enabled));
         }
     }
     $form_state->setRedirect('filter.admin_overview');
     return $this->entity;
 }
开发者ID:aWEBoLabs,项目名称:taxi,代码行数:27,代码来源:FilterFormatFormBase.php

示例11: submitForm

 /**
  * {@inheritdoc}
  */
 public function submitForm(array &$form, FormStateInterface $form_state)
 {
     parent::submitForm($form, $form_state);
     $this->plugin->submitConfigurationForm($form['settings'], $form_state);
 }
开发者ID:justincletus,项目名称:webdrupalpro,代码行数:8,代码来源:PaymentMethodForm.php

示例12: submitForm

 /**
  * {@inheritdoc}
  */
 public function submitForm(array &$form, FormStateInterface $form_state)
 {
     parent::submitForm($form, $form_state);
     /** @var \Drupal\search_api\ServerInterface $server */
     $authorization_profile = $this->getEntity();
     // Check before loading the provider plugin so we don't throw an exception.
     if ($form['provider_config']['#type'] == 'details' && $authorization_profile->hasValidProvider()) {
         $provider_form_state = new SubFormState($form_state, array('provider_config'));
         $authorization_profile->getProvider()->submitConfigurationForm($form['provider_config'], $provider_form_state);
     }
     // Check before loading the consumer plugin so we don't throw an exception.
     if ($form['consumer_config']['#type'] == 'details' && $authorization_profile->hasValidConsumer()) {
         $consumer_form_state = new SubFormState($form_state, array('consumer_config'));
         $authorization_profile->getConsumer()->submitConfigurationForm($form['consumer_config'], $consumer_form_state);
     }
     // @TODO Submit Row forms
     if ($form['mappings']) {
         $mappings_form_state = new SubFormState($form_state, array('mappings'));
         $authorization_profile->getConsumer()->submitRowForm($form['mappings'], $mappings_form_state);
         $authorization_profile->getProvider()->submitRowForm($form['mappings'], $mappings_form_state);
         // Move provider_mappings to the top level
         // @TODO fix this. Why do we have to do it? Why doesn't it work?
         $values = $form_state->getValues();
         $values['provider_mappings'] = $values['mappings']['provider_mappings'];
         unset($values['mappings']['provider_mappings']);
         $values['consumer_mappings'] = $values['mappings']['consumer_mappings'];
         unset($values['mappings']['consumer_mappings']);
         $form_state->setValues($values);
         // @TODO shouldn't have to do this. Though the above doesn't work either.
         // @TODO should validate beforehand to make sure that we have mappings.
         if ($values['provider_mappings']) {
             $authorization_profile->setProviderMappings($values['provider_mappings']);
         }
         if ($values['consumer_mappings']) {
             $authorization_profile->setConsumerMappings($values['consumer_mappings']);
         }
     }
     return $authorization_profile;
 }
开发者ID:Laudanum,项目名称:authorization,代码行数:42,代码来源:AuthorizationProfileForm.php

示例13: submitForm

 /**
  * {@inheritdoc}
  */
 public function submitForm(array &$form, FormStateInterface $form_state)
 {
     $this->getParentPaymentStatusSelector($form_state)->submitSelectorForm($form['parent_id'], $form_state);
     parent::submitForm($form, $form_state);
 }
开发者ID:nishantkumar155,项目名称:drupal8.crackle,代码行数:8,代码来源:PaymentStatusForm.php

示例14: submitForm

 /**
  * {@inheritdoc}
  */
 public function submitForm(array &$form, FormStateInterface $form_state)
 {
     // Submit plugin configuration if available.
     if ($plugin = $this->entity->getEncryptionMethod()) {
         if ($plugin instanceof EncryptionMethodPluginFormInterface) {
             $plugin_form_state = $this->createPluginFormState($form_state);
             $plugin->submitConfigurationForm($form, $plugin_form_state);
             $form_state->setValue('encryption_method_configuration', $plugin_form_state->getValues());
         }
     }
     parent::submitForm($form, $form_state);
 }
开发者ID:rlhawk,项目名称:encrypt,代码行数:15,代码来源:EncryptionProfileForm.php

示例15: submitForm

 /**
  * {@inheritdoc}
  */
 public function submitForm(array &$form, FormStateInterface $form_state)
 {
     /** @var \Drupal\payment\Plugin\Payment\MethodConfiguration\PaymentMethodConfigurationInterface $payment_method_configuration */
     $payment_method_configuration = $form_state->get('payment_method_configuration');
     $payment_method_configuration->submitConfigurationForm($form['plugin_form'], $form_state);
     parent::submitForm($form, $form_state);
 }
开发者ID:nishantkumar155,项目名称:drupal8.crackle,代码行数:10,代码来源:PaymentMethodConfigurationForm.php


注:本文中的Drupal\Core\Entity\EntityForm::submitForm方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。