Skip to content

Commit

Permalink
OEL-481: Make the fields created by oe_authentication_user_fields con…
Browse files Browse the repository at this point in the history
…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.
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);
}
}
}
}

0 comments on commit e6e5244

Please sign in to comment.