You are here

protected function BundleFormAlter::prepare in Organic groups 8

Prepares object properties and adds the og details element.

Parameters

array $form: The form variable.

\Drupal\Core\Form\FormStateInterface $form_state: The form state object.

1 call to BundleFormAlter::prepare()
BundleFormAlter::formAlter in og_ui/src/BundleFormAlter.php
This is a helper for og_ui_form_alter().

File

og_ui/src/BundleFormAlter.php, line 94

Class

BundleFormAlter
Helper for og_ui_form_alter().

Namespace

Drupal\og_ui

Code

protected function prepare(array &$form, FormStateInterface $form_state) {

  // Example: article.
  $this->bundle = $this->entity
    ->id();

  // Example: Article.
  $this->bundleLabel = Unicode::lcfirst($this->entity
    ->label());
  $this->definition = $this->entity
    ->getEntityType();

  // Example: node.
  $this->entityTypeId = $this->definition
    ->getBundleOf();
  $form['og'] = [
    '#type' => 'details',
    '#title' => new TranslatableMarkup('Organic groups'),
    '#collapsible' => TRUE,
    '#group' => 'additional_settings',
    '#description' => new TranslatableMarkup('This bundle may serve as a group, may belong to a group, or may not participate in OG at all.'),
  ];
}