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


PHP FormStateInterface::cleanValues方法代码示例

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


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

示例1: 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

示例2: submitForm

 /**
  * {@inheritdoc}
  */
 public function submitForm(array &$form, FormStateInterface $form_state)
 {
     $form_state->cleanValues();
     // This won't have a proper JSON header, but Drupal doesn't check for that
     // anyway so this is fine until it's replaced with a JsonResponse.
     print Json::encode($form_state->getValues());
     exit;
 }
开发者ID:davidsoloman,项目名称:drupalconsole.com,代码行数:11,代码来源:FormTestFormStateValuesCleanForm.php

示例3: submitForm

 /**
  * {@inheritdoc}
  */
 public function submitForm(array &$form, FormStateInterface $form_state)
 {
     // Remove Form API elements from $form_state
     $form_state->cleanValues();
     db_merge('uc_attribute_options')->key(array('aid' => $form_state->getValue('aid'), 'oid' => $form_state->getValue('oid')))->fields($form_state->getValues())->execute();
     drupal_set_message($this->t('Updated option %option.', ['%option' => $form_state->getValue('name')]));
     $this->logger('uc_attribute')->notice('Updated option %option.', ['%option' => $form_state->getValue('name'), 'link' => 'admin/store/products/attributes/' . $form_state->getValue('aid') . '/options/' . $form_state->getValue('oid')]);
     $form_state->setRedirect('uc_attribute.options', ['aid' => $form_state->getValue('aid')]);
 }
开发者ID:pedrocones,项目名称:hydrotools,代码行数:12,代码来源:OptionEditForm.php

示例4: submitForm

 /**
  * {@inheritdoc}
  */
 public function submitForm(array &$form, FormStateInterface $form_state)
 {
     $builder = $this->createBuilder($form_state->getValue('builder_id'));
     $values = $form_state->cleanValues()->getValues();
     $view = $builder->createView($values);
     $view->save();
     // Redirect the user to the view admin form.
     $form_state->setRedirectUrl($view->toUrl('edit-form'));
 }
开发者ID:CIGIHub,项目名称:bsia-drupal8,代码行数:12,代码来源:ViewTemplateForm.php

示例5: submitForm

 /**
  * {@inheritdoc}
  */
 public function submitForm(array &$form, FormStateInterface $form_state)
 {
     $config = $this->config('better_formats.settings');
     $form_state->cleanValues();
     foreach ($form_state->getValues() as $key => $value) {
         $config->set($key, $value);
     }
     $config->save();
     parent::submitForm($form, $form_state);
 }
开发者ID:penguinclub,项目名称:penguinweb_drupal8,代码行数:13,代码来源:SettingsForm.php

示例6: 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

示例7: submitForm

 /**
  * {@inheritdoc}
  */
 public function submitForm(array &$form, FormStateInterface $form_state)
 {
     $node = $form['#node'];
     /** @var \Drupal\webform\ComponentBase $component */
     $component = $form['#component'];
     $values = $form_state->cleanValues()->getValues();
     $component->setConfiguration($values);
     $component->save();
     drupal_set_message($this->t('Changes to the webform have been saved.'));
     $config = $component->getConfiguration();
     // @todo Is value actually being used in the form after save()?
     $form['cid'] = array('#type' => 'value', '#value' => $config['cid']);
     $form_state->setRedirect('webform.components', array('node' => $node->id()));
 }
开发者ID:edwardchan,项目名称:d8-drupalvm,代码行数:17,代码来源:WebformComponentFormBase.php

示例8: submitForm

 /**
  * {@inheritdoc}
  */
 public function submitForm(array &$form, FormStateInterface $form_state)
 {
     $admin = $form_state->getValue('administer_users');
     if (!\Drupal::config('user.settings')->get('verify_mail') || $admin) {
         $pass = $form_state->getValue('pass');
     } else {
         $pass = user_password();
     }
     // Remove unneeded values.
     $form_state->cleanValues();
     $form_state->setValue('pass', $pass);
     $form_state->setValue('init', $form_state->getValue('mail'));
     parent::submitForm($form, $form_state);
 }
开发者ID:davidsoloman,项目名称:drupalconsole.com,代码行数:17,代码来源:RegisterForm.php

示例9: submitForm

  /**
   * {@inheritdoc}
   */
  public function submitForm(array &$form, FormStateInterface $form_state) {
    $values = $form_state->cleanValues()->getValues();

    $config = $this->configFactory()->getEditable('eform.type_defaults');
    $keys = array_keys($config->getRawData());
    foreach ($keys as $key) {
      $config->clear($key);
    }

    foreach ($values as $key => $value) {
      $config->set($key, $value);
    }
    $config->save();

    parent::submitForm($form, $form_state);
  }
开发者ID:AshishNaik021,项目名称:iimisac-d8,代码行数:19,代码来源:EFormTypeDefaultsForm.php

示例10: submitForm

 /**
  * {@inheritdoc}
  */
 public function submitForm(array &$form, FormStateInterface $form_state)
 {
     $form_state->cleanValues();
     if ($form_state->hasValue('mid')) {
         db_merge('uc_weightquote_methods')->key(array('mid' => $form_state->getValue('mid')))->fields($form_state->getValues())->execute();
         drupal_set_message(t('Weight quote shipping method was updated.'));
         $form_state->setRedirect('uc_quote.methods');
     } else {
         db_insert('uc_weightquote_methods')->fields($form_state->getValues())->execute();
         // Ensure Rules picks up the new condition.
         // entity_flush_caches();
         drupal_set_message(t('Created and enabled new weight quote shipping method.'));
         $form_state->setRedirect('uc_quote.methods');
         //$form_state['redirect'] = 'admin/store/config/quotes/manage/get_quote_from_weightquote_' . $form_state->getValue('mid');
     }
 }
开发者ID:pedrocones,项目名称:hydrotools,代码行数:19,代码来源:WeightquoteEditForm.php

示例11: submitForm

  /**
   * {@inheritdoc}
   */
  public function submitForm(array &$form, FormStateInterface $form_state) {
    $form_state->cleanValues();
    $plugin_data = (new FormState())->setValues($form_state->getValues());
    $this->linkitMatcher->submitConfigurationForm($form, $plugin_data);
    $this->linkitProfile->save();

    drupal_set_message($this->t('Saved %label configuration.', array('%label' => $this->linkitMatcher->getLabel())));
    $this->logger('linkit')->notice('The matcher %label has been updated in the @profile profile.', [
      '%label' => $this->linkitMatcher->getLabel(),
      '@profile' => $this->linkitProfile->label(),
    ]);

    $form_state->setRedirect('linkit.matchers', [
      'linkit_profile' => $this->linkitProfile->id(),
    ]);
  }
开发者ID:eloiv,项目名称:botafoc.cat,代码行数:19,代码来源:EditForm.php

示例12: submitForm

  public function submitForm(array &$form, FormStateInterface $form_state) {
    $form_state->cleanValues();

    /** @var \Drupal\fillpdf\FillPdfFormInterface $fillpdf_form */
    $fillpdf_form = $this->getEntity();

    $mappings = $form_state->getValue('mappings');

    /** @var \Drupal\fillpdf\FillPdfFormInterface $imported_form */
    $imported_form = $mappings['form'];

    /** @var array $imported_fields */
    $imported_fields = $mappings['fields'];

    $unmatched_pdf_keys = $this->serializer->importForm($fillpdf_form, $imported_form, $imported_fields);

    foreach ($unmatched_pdf_keys as $unmatched_pdf_key) {
      drupal_set_message($this->t('Your code contained field mappings for the PDF field key <em>@pdf_key</em>, but it does not exist on this form. Therefore, it was ignored.', ['@pdf_key' => $unmatched_pdf_key]), 'warning');
    }

    drupal_set_message($this->t('Successfully imported FillPDF form configuration and matching PDF field keys. If any field mappings failed to import, they are listed above.'));

    $form_state->setRedirect('entity.fillpdf_form.edit_form', ['fillpdf_form' => $fillpdf_form->id()]);
  }
开发者ID:AshishNaik021,项目名称:iimisac-d8,代码行数:24,代码来源:FillPdfFormImportForm.php

示例13: submitForm

 /**
  * {@inheritdoc}
  */
 public function submitForm(array &$form, FormStateInterface $form_state)
 {
     $form_state->cleanValues();
     $layout_blocks = $form_state->getValue('layout', []);
     if (!is_array($layout_blocks)) {
         $layout_blocks = [];
     }
     // If no content blocks has been created for this entity then we need to
     // transfer the default blocks to the loaded content entity as entity
     // layout blocks.
     if (!$this->entityLayoutService->hasContentBlocks($this->entity, $this->contentEntity)) {
         $block_collection = $this->entity->getDefaultBlocks();
         // Update the default blocks with new configuration values from the
         // form state before transferring the blocks since weights may have
         // been changed.
         foreach ($layout_blocks as $layout_block_id => $layout_block_configuration) {
             $configuration = $block_collection->get($layout_block_id)->getConfiguration();
             $block_collection->setInstanceConfiguration($layout_block_id, $layout_block_configuration + $configuration);
         }
         $this->entityLayoutService->transferBlocks($this->entity, $this->contentEntity, $block_collection);
     } else {
         $content_blocks = $this->entityLayoutService->getContentBlocksByEntity($this->contentEntity);
         foreach ($layout_blocks as $layout_block_id => $layout_block_configuration) {
             foreach ($content_blocks as $content_block) {
                 if ($layout_block_id !== $content_block->uuid()) {
                     continue;
                 }
                 $content_block->updateBlock($layout_block_configuration);
                 $content_block->save();
             }
         }
     }
     drupal_set_message($this->t('The layout for @label has been saved.', ['@label' => $this->contentEntity->label()]));
 }
开发者ID:oddhill,项目名称:entity_layout,代码行数:37,代码来源:EntityLayoutContentEditForm.php

示例14: testCleanValues

 /**
  * @covers ::cleanValues
  */
 public function testCleanValues()
 {
     $this->decoratedFormState->cleanValues()->shouldBeCalled();
     $this->assertSame($this->formStateDecoratorBase, $this->formStateDecoratorBase->cleanValues());
 }
开发者ID:eigentor,项目名称:tommiblog,代码行数:8,代码来源:FormStateDecoratorBaseTest.php

示例15: submitForm

 /**
  * {@inheritdoc}
  */
 public function submitForm(array &$form, FormStateInterface $form_state)
 {
     $form_state->cleanValues();
     // The image effect configuration is stored in the 'data' key in the form,
     // pass that through for submission.
     $effect_data = (new FormState())->setValues($form_state->getValue('data'));
     $this->imageEffect->submitConfigurationForm($form, $effect_data);
     // Update the original form values.
     $form_state->setValue('data', $effect_data->getValues());
     $this->imageEffect->setWeight($form_state->getValue('weight'));
     if (!$this->imageEffect->getUuid()) {
         $this->imageStyle->addImageEffect($this->imageEffect->getConfiguration());
     }
     $this->imageStyle->save();
     drupal_set_message($this->t('The image effect was successfully applied.'));
     $form_state->setRedirectUrl($this->imageStyle->urlInfo('edit-form'));
 }
开发者ID:davidsoloman,项目名称:drupalconsole.com,代码行数:20,代码来源:ImageEffectFormBase.php


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