本文整理汇总了PHP中Drupal\Core\Entity\EntityForm::copyFormValuesToEntity方法的典型用法代码示例。如果您正苦于以下问题:PHP EntityForm::copyFormValuesToEntity方法的具体用法?PHP EntityForm::copyFormValuesToEntity怎么用?PHP EntityForm::copyFormValuesToEntity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Drupal\Core\Entity\EntityForm
的用法示例。
在下文中一共展示了EntityForm::copyFormValuesToEntity方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: copyFormValuesToEntity
/**
* {@inheritdoc}
*/
protected function copyFormValuesToEntity(EntityInterface $payment_method_configuration, array $form, FormStateInterface $form_state)
{
/** @var \Drupal\payment\Entity\PaymentMethodConfigurationInterface $payment_method_configuration */
parent::copyFormValuesToEntity($payment_method_configuration, $form, $form_state);
$values = $form_state->getValues();
/** @var \Drupal\payment\Plugin\Payment\MethodConfiguration\PaymentMethodConfigurationInterface $payment_method_configuration_plugin */
$payment_method_configuration_plugin = $form_state->get('payment_method_configuration');
$payment_method_configuration->setLabel($values['label']);
$payment_method_configuration->setStatus($values['status']);
$payment_method_configuration->setOwnerId($values['owner']);
$payment_method_configuration->setPluginConfiguration($payment_method_configuration_plugin instanceof ConfigurablePluginInterface ? $payment_method_configuration_plugin->getConfiguration() : []);
}
示例2: copyFormValuesToEntity
/**
* {@inheritdoc}
*/
protected function copyFormValuesToEntity(EntityInterface $payment_status, array $form, FormStateInterface $form_state)
{
/** @var \Drupal\payment\Entity\PaymentStatusInterface $payment_status */
parent::copyFormValuesToEntity($payment_status, $form, $form_state);
$values = $form_state->getValues();
$payment_status->setId($values['id']);
$payment_status->setLabel($values['label']);
$selected_parent = $this->getParentPaymentStatusSelector($form_state)->getSelectedPlugin();
$payment_status->setParentId($selected_parent ? $selected_parent->getPluginId() : NULL);
$payment_status->setDescription($values['description']);
}
示例3: copyFormValuesToEntity
/**
* {@inheritdoc}
*/
protected function copyFormValuesToEntity(EntityInterface $entity, array $form, FormStateInterface $form_state)
{
/** @var \Drupal\media_entity\MediaBundleInterface $entity */
parent::copyFormValuesToEntity($entity, $form, $form_state);
// Use type configuration for the plugin that was chosen.
$configuration = $form_state->getValue('type_configuration');
$configuration = empty($configuration[$entity->getType()->getPluginId()]) ? [] : $configuration[$entity->getType()->getPluginId()];
$entity->set('type_configuration', $configuration);
}