本文整理匯總了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();
}
示例2: get
/**
* {@inheritdoc}
*/
public function get($field_name)
{
return $this->subject->get($field_name);
}