You are here

public function FormModeManagerRolesForm::buildFormPerEntity in Form mode manager 8.2

Build form element per compatible entities.

Parameters

array $form: An associative array containing the structure of the form.

array $form_modes: The form modes collection for given entity type.

string $entity_type_id: The entity type ID of entity.

Return value

string The name of the theme

Overrides FormModeManagerFormBase::buildFormPerEntity

File

modules/form_mode_user_roles_assign/src/Form/FormModeManagerRolesForm.php, line 81

Class

FormModeManagerRolesForm
Configure Form for Form Mode Manager Role Assign settings.

Namespace

Drupal\form_mode_user_roles_assign\Form

Code

public function buildFormPerEntity(array &$form, array $form_modes, $entity_type_id) {
  if ('user' !== $entity_type_id) {
    return $this;
  }
  $entity_label = $this->entityTypeManager
    ->getStorage($entity_type_id)
    ->getEntityType()
    ->getLabel();
  $form['user_assign_form_mode_settings'][$entity_type_id] = [
    '#type' => 'details',
    '#title' => $entity_label,
    '#description' => $this
      ->t('Allows you to configure the user role automatically assigned for the entity <b>@entity_type_id</b> on registration form.', [
      '@entity_type_id' => $entity_label,
    ]),
    '#group' => 'vertical_tabs_per_modes',
  ];
  return $this;
}