function _password_policy_user_profile_form_after_build in Password Policy 8.3
After build callback for the user profile form.
Hides the password policy status when the password field is not visible. Some modules will hide the password field if the user is authenticated through an external service rather than through Drupal. In this situation the password policy status is not applicable.
Parameters
mixed $form: Form definition for the user profile form.
\Drupal\Core\Form\FormStateInterface $form_state: Form state of the user profile form.
Return value
array The updated form.
1 string reference to '_password_policy_user_profile_form_after_build'
- password_policy_form_user_form_alter in ./
password_policy.module - Implements hook_form_FORM_ID_alter() for user_form().
File
- ./
password_policy.module, line 150 - Module file for the Password Policy module.
Code
function _password_policy_user_profile_form_after_build($form, FormStateInterface &$form_state) {
$password_invisible = empty($form['account']['pass']) || (isset($form['account']['pass']['#access']) ? !$form['account']['pass']['#access'] : FALSE);
if ($password_invisible) {
$form['account']['password_policy_status']['#access'] = FALSE;
}
return $form;
}