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


PHP AccountInterface::getEmail方法代码示例

本文整理汇总了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;
 }
开发者ID:boobaa,项目名称:d7to8,代码行数:19,代码来源:D8AccessDisplayController.php

示例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;
 }
开发者ID:Wylbur,项目名称:gj,代码行数:33,代码来源:WebTestBase.php


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