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


PHP ContentEntityForm::save方法代码示例

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


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

示例1: saveDraft

  public function saveDraft(array $form, FormStateInterface $form_state) {
    /** @var \Drupal\eform\Entity\EFormSubmission $entity */
    $entity = $this->entity;

    $entity->setDraft(EFORM_DRAFT);
    return parent::save($form, $form_state);
  }
开发者ID:AshishNaik021,项目名称:iimisac-d8,代码行数:7,代码来源:EFormSubmissionForm.php

示例2: save

  public function save(array $form, FormStateInterface $form_state) {
    /** @var FillPdfFormInterface $entity */
    $entity = $this->entity;

    $form_state->setRedirect('entity.fillpdf_form.edit_form', [
      'fillpdf_form' => $this->entity->fillpdf_form->target_id,
    ]);

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

示例3: save

 /**
  * {@inheritdoc}
  */
 public function save(array $form, FormStateInterface $form_state)
 {
     $entity = $this->entity;
     $status = parent::save($form, $form_state);
     switch ($status) {
         case SAVED_NEW:
             drupal_set_message($this->t('Created the %label Component.', ['%label' => $entity->label()]));
             break;
         default:
             drupal_set_message($this->t('Saved the %label Component.', ['%label' => $entity->label()]));
     }
     $form_state->setRedirect('entity.component.canonical', ['component' => $entity->id()]);
 }
开发者ID:poetic,项目名称:clutch,代码行数:16,代码来源:ComponentForm.php

示例4: save

 /**
  * {@inheritdoc}
  */
 public function save(array $form, FormStateInterface $form_state)
 {
     parent::save($form, $form_state);
     /** @var LocalTaskItem $task_item */
     $task_item = $this->entity;
     $form_state->cleanValues();
     foreach ($form_state->getValues() as $key => $value) {
         if (is_array($value) && isset($value['translation'])) {
             // Update the translation, this will only update the translation in case
             // it has changed. We have two different cases, the first is for nested
             // texts.
             if (is_array($value['translation'])) {
                 $update['#translation']['#text'] = $value['translation']['value'];
             } else {
                 $update['#translation']['#text'] = $value['translation'];
             }
             $task_item->updateData($key, $update);
         }
     }
     $task_item->save();
     if ($form_state->getTriggeringElement()['#value'] == $form['actions']['save']['#value']) {
         drupal_set_message(t('The translation for <a href=:task_item>@task_item_title</a> has been saved.', [':task_item' => $task_item->urlInfo()->toString(), '@task_item_title' => $task_item->label()]));
     }
     $task = $task_item->getTask();
     $uri = $task->urlInfo();
     $form_state->setRedirect($uri->getRouteName(), $uri->getRouteParameters());
 }
开发者ID:andrewl,项目名称:andrewlnet,代码行数:30,代码来源:LocalTaskItemForm.php

示例5: save

 /**
  * {@inheritDoc}
  */
 public function save(array $form, FormStateInterface $form_state)
 {
     parent::save($form, $form_state);
     // Redirect to stored entry.
     $form_state->setRedirect('entity.mollom_test_post.edit_form', array('mollom_test_post' => $this->entity->id()));
 }
开发者ID:ABaldwinHunter,项目名称:durhamatletico-cms,代码行数:9,代码来源:PostForm.php


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