Commit 8b8cf18e authored by o.tarasiuk@internetdevels.com's avatar o.tarasiuk@internetdevels.com
Browse files

ver1.0

parent b852ad6c
......@@ -5,7 +5,7 @@
* Contains multiple_registration.module.
*/
use Drupal\Core\Render\Element;
use Drupal\Core\Link;
use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\Core\Entity\EntityInterface;
......@@ -119,35 +119,6 @@ function multiple_registration_form_field_config_edit_form_alter(&$form, FormSta
}
}
/**
* Disabling of displaying fields assigned for special user roles at user page.
*
* @param array $variables
* Provides theme hook variables array.
*/
function multiple_registration_preprocess_user(array &$variables) {
// $user = $variables['elements']['#user'];
/* @var \Drupal\user\Entity\User $user */
// $user_roles = $user->getRoles();
// $fields = $user->getFields();
// foreach ($fields as $field_name => $field_data) {
// /* @var Drupal\Core\Field\FieldItemList $field_data */
// $field_definition = $field_data->getFieldDefinition();
// if (\property_exists($field_definition, 'third_party_settings')) {
// /* @var Drupal\field\Entity\FieldConfig $field_definition */
// $third_party_settings = $field_definition->get('third_party_settings');
// if (\array_key_exists('multiple_registration', $third_party_settings)) {
// $allowed_roles = $third_party_settings['multiple_registration']['user_additional_register_form'];
// $found_roles = array_intersect($user_roles, $allowed_roles);
// if (empty($found_roles)) {
// if ($field_name !== 'user_picture') {
// unset($variables['elements'][$field_name], $variables['content'][$field_name]);
// }
// }
// }
// }
// }
}
/**
* Form submit to save additional field settings.
......@@ -214,16 +185,6 @@ function multiple_registration_field_widget_form_alter(&$element, FormStateInter
if ($field_roles !== NULL && count($field_roles) > 0) {
$element['#access'] = MultipleRegistrationController::checkFieldAccess($field_roles);
}
// if (!$element['#required'] && !empty($field_roles_required)) {
// If something was selected.
// if (max($field_roles_required) !== 0) {
// $required = MultipleRegistrationController::checkFieldAccess($field_roles_required);
// $element['#required'] = $required;
// foreach (Element::children($element) as $child) {
// $element[$child]['#required'] = $required;
// }
// }
// }
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment