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


PHP FormState::getValue方法代码示例

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


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

示例1: submitForm

 /**
  * Form submit handler to flush Mollom session and form information from cache.
  *
  * This is necessary as the entity forms will no longer automatically save
  * the data with the entity.
  *
  * @todo: Possible problems:
  *   - This submit handler is invoked too late; the primary submit handler might
  *     send out e-mails directly after saving the entity (e.g.,
  *     user_register_form_submit()), so mollom_mail_alter() is invoked before
  *     Mollom session data has been saved.
  */
 public static function submitForm($form, FormState $form_state)
 {
     // Some modules are implementing multi-step forms without separate form
     // submit handlers. In case we reach here and the form will be rebuilt, we
     // need to defer our submit handling until final submission.
     $is_rebuilding = $form_state->isRebuilding();
     if ($is_rebuilding) {
         return;
     }
     $mollom = $form_state->getValue('mollom');
     $form_object = $form_state->getFormObject();
     // If an 'entity' and a 'post_id' mapping was provided via
     // hook_mollom_form_info(), try to automatically store Mollom session data.
     if (empty($mollom) || empty($mollom['entity']) || !$form_state->getFormObject() instanceof EntityFormInterface) {
         return;
     }
     /* @var $form_object \Drupal\Core\Entity\EntityFormInterface */
     $entity_id = $form_object->getEntity()->id();
     $data = (object) $mollom;
     $data->id = $entity_id;
     $data->moderate = $mollom['require_moderation'] ? 1 : 0;
     $stored_data = ResponseDataStorage::save($data);
     $form_state->setValue(['mollom', 'data'], $stored_data);
 }
开发者ID:isramv,项目名称:camp-gdl,代码行数:36,代码来源:FormController.php


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