-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
OEL-481: Make the fields created by oe_authentication_user_fields con…
…figurable in the form and view displays.
- Loading branch information
Carlos Marco
committed
Nov 16, 2021
1 parent
74437af
commit e6e5244
Showing
1 changed file
with
29 additions
and
0 deletions.
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
29
modules/oe_whitelabel_user_profile/oe_whitelabel_user_profile.module
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
|
||
/** | ||
* @file | ||
* OE Whitelabel user profile module. | ||
*/ | ||
|
||
declare(strict_types = 1); | ||
|
||
use Drupal\Core\Entity\EntityTypeInterface; | ||
|
||
/** | ||
* Implements hook_entity_base_field_info_alter(). | ||
*/ | ||
function oe_whitelabel_user_profile_entity_base_field_info_alter(&$fields, EntityTypeInterface $entity_type) { | ||
if ($entity_type->id() == 'user') { | ||
$oe_fields = [ | ||
'field_oe_firstname', | ||
'field_oe_lastname', | ||
'field_oe_department', | ||
'field_oe_organisation', | ||
]; | ||
foreach ($oe_fields as $oe_field) { | ||
if (!empty($fields[$oe_field])) { | ||
$fields[$oe_field]->setDisplayConfigurable('form', TRUE)->setDisplayConfigurable('view', TRUE); | ||
} | ||
} | ||
} | ||
} |