本文整理汇总了PHP中Drupal\Core\Session\AccountInterface::getEmail方法的典型用法代码示例。如果您正苦于以下问题:PHP AccountInterface::getEmail方法的具体用法?PHP AccountInterface::getEmail怎么用?PHP AccountInterface::getEmail使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Drupal\Core\Session\AccountInterface
的用法示例。
在下文中一共展示了AccountInterface::getEmail方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
/**
* Display a given user's identity.
*
* @param \Drupal\Core\Session\AccountInterface|NULL $user
* The user to retrieve data on behalf of.
*
* @return array
* Render array with all the results.
*/
public function display(AccountInterface $user = NULL)
{
// Build the output (as a render array).
$output = ['#cache' => ['max-age' => 0]];
if ($user) {
$output['name'] = ['#markup' => $this->t('Name: %name', ['%name' => $user->getDisplayName()])];
$output['mail'] = ['#markup' => $this->t('Mail: %mail', ['%mail' => $user->getEmail()])];
}
return $output;
}
示例2: installParameters
/**
* Returns the parameters that will be used when Simpletest installs Drupal.
*
* @see install_drupal()
* @see install_state_defaults()
*
* @return array
* Array of parameters for use in install_drupal().
*/
protected function installParameters()
{
$connection_info = Database::getConnectionInfo();
$driver = $connection_info['default']['driver'];
$connection_info['default']['prefix'] = $connection_info['default']['prefix']['default'];
unset($connection_info['default']['driver']);
unset($connection_info['default']['namespace']);
unset($connection_info['default']['pdo']);
unset($connection_info['default']['init_commands']);
// Remove database connection info that is not used by SQLite.
if ($driver == 'sqlite') {
unset($connection_info['default']['username']);
unset($connection_info['default']['password']);
unset($connection_info['default']['host']);
unset($connection_info['default']['port']);
}
$parameters = array('interactive' => FALSE, 'parameters' => array('profile' => $this->profile, 'langcode' => 'en'), 'forms' => array('install_settings_form' => array('driver' => $driver, $driver => $connection_info['default']), 'install_configure_form' => array('site_name' => 'Drupal', 'site_mail' => 'simpletest@example.com', 'account' => array('name' => $this->rootUser->name, 'mail' => $this->rootUser->getEmail(), 'pass' => array('pass1' => $this->rootUser->pass_raw, 'pass2' => $this->rootUser->pass_raw)), 'update_status_module' => array(1 => NULL, 2 => NULL))));
// If we only have one db driver available, we cannot set the driver.
include_once DRUPAL_ROOT . '/core/includes/install.inc';
if (count($this->getDatabaseTypes()) == 1) {
unset($parameters['forms']['install_settings_form']['driver']);
}
return $parameters;
}