You are here

public function EntityVisibilityForm::buildForm in Open Social 10.1.x

Same name and namespace in other branches
  1. 8.9 modules/custom/entity_access_by_field/src/Form/EntityVisibilityForm.php \Drupal\entity_access_by_field\Form\EntityVisibilityForm::buildForm()
  2. 8 modules/custom/entity_access_by_field/src/Form/EntityVisibilityForm.php \Drupal\entity_access_by_field\Form\EntityVisibilityForm::buildForm()
  3. 8.2 modules/custom/entity_access_by_field/src/Form/EntityVisibilityForm.php \Drupal\entity_access_by_field\Form\EntityVisibilityForm::buildForm()
  4. 8.3 modules/custom/entity_access_by_field/src/Form/EntityVisibilityForm.php \Drupal\entity_access_by_field\Form\EntityVisibilityForm::buildForm()
  5. 8.4 modules/custom/entity_access_by_field/src/Form/EntityVisibilityForm.php \Drupal\entity_access_by_field\Form\EntityVisibilityForm::buildForm()
  6. 8.5 modules/custom/entity_access_by_field/src/Form/EntityVisibilityForm.php \Drupal\entity_access_by_field\Form\EntityVisibilityForm::buildForm()
  7. 8.6 modules/custom/entity_access_by_field/src/Form/EntityVisibilityForm.php \Drupal\entity_access_by_field\Form\EntityVisibilityForm::buildForm()
  8. 8.7 modules/custom/entity_access_by_field/src/Form/EntityVisibilityForm.php \Drupal\entity_access_by_field\Form\EntityVisibilityForm::buildForm()
  9. 8.8 modules/custom/entity_access_by_field/src/Form/EntityVisibilityForm.php \Drupal\entity_access_by_field\Form\EntityVisibilityForm::buildForm()
  10. 10.3.x modules/custom/entity_access_by_field/src/Form/EntityVisibilityForm.php \Drupal\entity_access_by_field\Form\EntityVisibilityForm::buildForm()
  11. 10.0.x modules/custom/entity_access_by_field/src/Form/EntityVisibilityForm.php \Drupal\entity_access_by_field\Form\EntityVisibilityForm::buildForm()
  12. 10.2.x modules/custom/entity_access_by_field/src/Form/EntityVisibilityForm.php \Drupal\entity_access_by_field\Form\EntityVisibilityForm::buildForm()

Form constructor.

Parameters

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

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Return value

array The form structure.

Overrides ConfigFormBase::buildForm

File

modules/custom/entity_access_by_field/src/Form/EntityVisibilityForm.php, line 34

Class

EntityVisibilityForm
Class EntityVisibilityForm.

Namespace

Drupal\entity_access_by_field\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {

  // Get config for this form.
  $config = $this
    ->config('entity_access_by_field.settings');
  $form['disable_public_visibility'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Disable public visibility'),
    '#description' => $this
      ->t('Turning on this feature makes sure regular user can no longer post public content anywhere on the platform.'),
    '#default_value' => $config
      ->get('disable_public_visibility'),
  ];
  $form['default_visibility'] = [
    '#type' => 'select',
    '#title' => $this
      ->t('Default visibility'),
    '#default_value' => $config
      ->get('default_visibility'),
    '#options' => [
      'public' => $this
        ->t('Public - visible to everyone including people who are not a member'),
      'community' => $this
        ->t('Community - visible only to logged in members'),
    ],
  ];
  return parent::buildForm($form, $form_state);
}