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


PHP UserInterface::get方法代码示例

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


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

示例1: setUp

 /**
  * {@inheritdoc
  */
 protected function setUp()
 {
     parent::setUp();
     $this->paymentStorage = \Drupal::entityManager()->getStorage('payment');
     /** @var \Drupal\currency\ConfigImporterInterface $config_importer */
     $config_importer = \Drupal::service('currency.config_importer');
     $config_importer->importCurrency('EUR');
     // Create the field and field instance.
     $field_name = strtolower($this->randomMachineName());
     entity_create('field_storage_config', ['cardinality' => FieldStorageConfigInterface::CARDINALITY_UNLIMITED, 'entity_type' => 'user', 'field_name' => $field_name, 'type' => 'payment_form'])->save();
     entity_create('field_config', ['bundle' => 'user', 'entity_type' => 'user', 'field_name' => $field_name, 'settings' => ['currency_code' => 'EUR']])->save();
     entity_get_display('user', 'user', 'default')->setComponent($field_name, ['type' => 'payment_form'])->save();
     // Create an entity.
     $this->user = entity_create('user', ['name' => $this->randomString(), 'status' => TRUE]);
     foreach (Generate::createPaymentLineItems() as $line_item) {
         $this->user->get($field_name)->appendItem(['plugin_id' => $line_item->getPluginId(), 'plugin_configuration' => $line_item->getConfiguration()]);
     }
     $this->user->save();
     // Create a payment method.
     $this->paymentMethod = Generate::createPaymentMethodConfiguration(2, 'payment_basic');
     $this->paymentMethod->setPluginConfiguration(['execute_status_id' => $this->executeStatusPluginId]);
     $this->paymentMethod->save();
 }
开发者ID:nishantkumar155,项目名称:drupal8.crackle,代码行数:26,代码来源:PaymentFormWebTest.php

示例2: get

 /**
  * {@inheritdoc}
  */
 public function get($field_name)
 {
     return $this->subject->get($field_name);
 }
开发者ID:mosswoodcreative,项目名称:d8-api-test,代码行数:7,代码来源:TokenAuthUser.php


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