當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。