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


PHP ContentEntityForm::submit方法代码示例

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


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

示例1: submit

 /**
  * Overrides \Drupal\Core\Entity\EntityFormController::submit().
  */
 public function submit(array $form, array &$form_state)
 {
     // Build the entity object from the submitted values.
     $entity = parent::submit($form, $form_state);
     $form_state['redirect_route']['route_name'] = 'foo_bar.list';
     return $entity;
 }
开发者ID:bnchdrff,项目名称:foo_bar,代码行数:10,代码来源:FooBarFormController.php

示例2: submit

 /**
  * Overrides \Drupal\Core\Entity\EntityForm::submit().
  */
 public function submit(array $form, array &$form_state)
 {
     // Build the entity object from the submitted values.
     $entity = parent::submit($form, $form_state);
     // Save as a new revision if requested to do so.
     if (!empty($form_state['values']['revision'])) {
         $entity->setNewRevision();
     }
     return $entity;
 }
开发者ID:alnutile,项目名称:drunatra,代码行数:13,代码来源:EntityTestForm.php

示例3: submit

  /**
   * {@inheritdoc}
   */
  public function submit(array $form, FormStateInterface $form_state) {
    // Build the entity object from the submitted values.
    $entity = parent::submit($form, $form_state);

    return $entity;
  }
开发者ID:Koalasoft,项目名称:product_search,代码行数:9,代码来源:PoliticalDivisionForm.php

示例4: submitConfigurationForm

 /**
  * {@inheritdoc}
  */
 public function submitConfigurationForm(array &$form, FormStateInterface $form_state)
 {
     // Remove button and internal Form API values from submitted values.
     parent::submit($form, $form_state);
     $this->save($form, $form_state);
 }
开发者ID:anatalsceo,项目名称:en-classe,代码行数:9,代码来源:MenuLinkContentForm.php

示例5: submit

 /**
  * {@inheritdoc}
  */
 public function submit(array $form, FormStateInterface $form_state)
 {
     parent::submit($form, $form_state);
     $user = $this->getEntity($form_state);
     // If there's a session set to the users id, remove the password reset tag
     // since a new password was saved.
     if (isset($_SESSION['pass_reset_' . $user->id()])) {
         unset($_SESSION['pass_reset_' . $user->id()]);
     }
 }
开发者ID:anatalsceo,项目名称:en-classe,代码行数:13,代码来源:AccountForm.php

示例6: submit

 /**
  * Overrides Drupal\Core\Entity\EntityForm::submit().
  */
 public function submit(array $form, array &$form_state)
 {
     /** @var \Drupal\comment\CommentInterface $comment */
     $comment = parent::submit($form, $form_state);
     // If the comment was posted by a registered user, assign the author's ID.
     // @todo Too fragile. Should be prepared and stored in comment_form()
     // already.
     $author_name = $comment->getAuthorName();
     if (!$comment->is_anonymous && !empty($author_name) && ($account = user_load_by_name($author_name))) {
         $comment->setOwner($account);
     }
     // If the comment was posted by an anonymous user and no author name was
     // required, use "Anonymous" by default.
     if ($comment->is_anonymous && (!isset($author_name) || $author_name === '')) {
         $comment->setAuthorName($this->config('user.settings')->get('anonymous'));
     }
     // Validate the comment's subject. If not specified, extract from comment
     // body.
     if (trim($comment->getSubject()) == '') {
         // The body may be in any format, so:
         // 1) Filter it into HTML
         // 2) Strip out all HTML tags
         // 3) Convert entities back to plain-text.
         $comment_text = $comment->comment_body->processed;
         $comment->setSubject(Unicode::truncate(trim(String::decodeEntities(strip_tags($comment_text))), 29, TRUE));
         // Edge cases where the comment body is populated only by HTML tags will
         // require a default subject.
         if ($comment->getSubject() == '') {
             $comment->setSubject($this->t('(No subject)'));
         }
     }
     return $comment;
 }
开发者ID:alnutile,项目名称:drunatra,代码行数:36,代码来源:CommentForm.php

示例7: submit

 /**
  * Updates the node object by processing the submitted values.
  *
  * This function can be called by a "Next" button of a wizard to update the
  * form state's entity with the current step's values before proceeding to the
  * next step.
  *
  * Overrides Drupal\Core\Entity\EntityForm::submit().
  */
 public function submit(array $form, array &$form_state)
 {
     // Build the node object from the submitted values.
     $node = parent::submit($form, $form_state);
     // Save as a new revision if requested to do so.
     if (!empty($form_state['values']['revision']) && $form_state['values']['revision'] != FALSE) {
         $node->setNewRevision();
         // If a new revision is created, save the current user as revision author.
         $node->setRevisionCreationTime(REQUEST_TIME);
         $node->setRevisionAuthorId(\Drupal::currentUser()->id());
     } else {
         $node->setNewRevision(FALSE);
     }
     $node->validated = TRUE;
     foreach (\Drupal::moduleHandler()->getImplementations('node_submit') as $module) {
         $function = $module . '_node_submit';
         $function($node, $form, $form_state);
     }
     return $node;
 }
开发者ID:alnutile,项目名称:drunatra,代码行数:29,代码来源:NodeForm.php

示例8: submit

 /**
  * Overrides \Drupal\Core\Entity\EntityForm::submit().
  *
  * Updates the custom block object by processing the submitted values.
  *
  * This function can be called by a "Next" button of a wizard to update the
  * form state's entity with the current step's values before proceeding to the
  * next step.
  */
 public function submit(array $form, FormStateInterface $form_state)
 {
     // Build the block object from the submitted values.
     $block = parent::submit($form, $form_state);
     // Save as a new revision if requested to do so.
     if (!empty($form_state['values']['revision'])) {
         $block->setNewRevision();
     }
     return $block;
 }
开发者ID:anatalsceo,项目名称:en-classe,代码行数:19,代码来源:BlockContentForm.php


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