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


PHP EntityForm::save方法代码示例

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


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

示例1: save

 /**
  * {@inheritdoc}
  */
 public function save(array $form, FormStateInterface $form_state)
 {
     /* @var $entity \Drupal\workflow\Entity\Workflow */
     $entity = $this->entity;
     // Prevent leading and trailing spaces.
     $entity->set('label', trim($entity->label()));
     $entity->set('options', array('name_as_title' => $form_state->getValue('name_as_title'), 'fieldset' => $form_state->getValue('fieldset'), 'options' => $form_state->getValue('options'), 'schedule_timezone' => $form_state->getValue('schedule_timezone'), 'comment_log_node' => $form_state->getValue('comment_log_node'), 'comment_log_tab' => $form_state->getValue('comment_log_tab'), 'watchdog_log' => $form_state->getValue('watchdog_log')));
     $status = parent::save($form, $form_state);
     $action = $status == SAVED_UPDATED ? 'updated' : 'added';
     // Tell the user we've updated the data.
     $args = ['%label' => $entity->label(), '%action' => $action, 'link' => $entity->link(t('Edit'))];
     drupal_set_message($this->t('Workflow %label has been %action. Please maintain the permissions, states and transitions.', $args));
     $this->logger('workflow')->notice('Workflow %label has been %action.', $args);
     if ($status == SAVED_NEW) {
         $form_state->setRedirect('entity.workflow_type.edit_form', ['workflow_type' => $entity->id()]);
     }
 }
开发者ID:sedurzu,项目名称:ildeposito8,代码行数:20,代码来源:WorkflowForm.php

示例2: save

 /**
  * {@inheritdoc}
  */
 public function save(array $form, FormStateInterface $form_state)
 {
     parent::save($form, $form_state);
     $form_state->setRedirectUrl($this->entity->urlInfo('edit-form'));
 }
开发者ID:eigentor,项目名称:tommiblog,代码行数:8,代码来源:ImageStyleFormBase.php

示例3: save

 /**
  * {@inheritdoc}
  */
 public function save(array $form, FormStateInterface $form_state)
 {
     $status = parent::save($form, $form_state);
     if ($status) {
         drupal_set_message($this->t('Saved the %label Key.', array('%label' => $this->entity->label())));
     } else {
         drupal_set_message($this->t('The %label Key was not saved.', array('%label' => $this->entity->label())));
     }
     $form_state->setRedirectUrl($this->entity->urlInfo('collection'));
 }
开发者ID:rlhawk,项目名称:key,代码行数:13,代码来源:KeyForm.php

示例4: save

 /**
  * {@inheritDoc}
  */
 public function save(array $form, FormStateInterface $form_state)
 {
     parent::save($form, $form_state);
     drupal_set_message($this->t('Pattern @label saved.', ['@label' => $this->entity->label()]));
     $form_state->setRedirectUrl($this->entity->toUrl('collection'));
 }
开发者ID:CIGIHub,项目名称:bsia-drupal8,代码行数:9,代码来源:PatternEditForm.php

示例5: save

 /**
  * {@inheritdoc}
  */
 public function save(array $form, FormStateInterface $form_state)
 {
     /** @var \Drupal\flexslider\Entity\Flexslider $flexslider */
     $flexslider = $this->entity;
     $status = parent::save($form, $form_state);
     switch ($status) {
         case SAVED_NEW:
             drupal_set_message($this->t('Created the %label FlexSlider optionset.', ['%label' => $flexslider->label()]));
             break;
         default:
             drupal_set_message($this->t('Saved the %label FlexSlider optionset.', ['%label' => $flexslider->label()]));
     }
     $form_state->setRedirectUrl($flexslider->toUrl('collection'));
 }
开发者ID:r-daneelolivaw,项目名称:chalk,代码行数:17,代码来源:FlexsliderForm.php

示例6: save

 /**
  * {@inheritdoc}
  */
 public function save(array $form, FormStateInterface $form_state)
 {
     parent::save($form, $form_state);
     $payment_method_configuration = $this->getEntity();
     drupal_set_message($this->t('@label has been saved.', array('@label' => $payment_method_configuration->label())));
     $form_state->setRedirectUrl($payment_method_configuration->urlInfo('collection'));
 }
开发者ID:nishantkumar155,项目名称:drupal8.crackle,代码行数:10,代码来源:PaymentMethodConfigurationForm.php

示例7: save

 /**
  * {@inheritdoc}
  */
 public function save(array $form, FormStateInterface $form_state)
 {
     $status = parent::save($form, $form_state);
     if ($status) {
         drupal_set_message($this->t('Saved the %label variant.', ['%label' => $this->entity->label()]));
     } else {
         drupal_set_message($this->t('The %label variant was not saved.', ['%label' => $this->entity->label()]));
     }
 }
开发者ID:neeravbm,项目名称:unify-d8,代码行数:12,代码来源:PageVariantFormBase.php


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