本文整理匯總了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;
}