You are here

public function InstagramAccountForm::form in Instagram Feeds 8

Gets the actual form array to be built.

Overrides ContentEntityForm::form

See also

\Drupal\Core\Entity\EntityForm::processForm()

\Drupal\Core\Entity\EntityForm::afterBuild()

File

src/Form/InstagramAccountForm.php, line 72

Class

InstagramAccountForm
Provides the InstagramAccount add/edit form.

Namespace

Drupal\instagram_feeds\Form

Code

public function form(array $form, FormStateInterface $form_state) {
  if (empty($this
    ->getConfig('client_id')) || empty($this
    ->getConfig('client_secret'))) {
    return $form;
  }

  /** @var \Drupal\instagram_feeds\Entity\InstagramAccountInterface $i_account */
  $i_account = $this
    ->getEntity();
  if ($this->operation == 'edit') {
    $form['#title'] = $this
      ->t('<em>Edit @type</em> @title', [
      '@type' => $i_account
        ->getEntityType()
        ->getLabel(),
      '@title' => $i_account
        ->label(),
    ]);
  }
  $form = parent::form($form, $form_state);

  // TODO: Disable / hide fields with data from Instagram.
  $form['status']['#group'] = 'footer';
  return $form;
}