Mail.php in User protect 8
File
src/Plugin/UserProtection/Mail.php
View source
<?php
namespace Drupal\userprotect\Plugin\UserProtection;
use Drupal\Core\Form\FormStateInterface;
class Mail extends UserProtectionBase {
public function applyAccountFormProtection(array &$form, FormStateInterface $form_state) {
$build_info = $form_state
->getBuildInfo();
$account = $build_info['callback_object']
->getEntity();
if ($account
->getEmail() && isset($form['account']['mail'])) {
$form['account']['mail']['#disabled'] = TRUE;
$form['account']['mail']['#value'] = $account
->getEmail();
return TRUE;
}
return FALSE;
}
}
Classes
Name |
Description |
Mail |
Protects user's mail address. |