public function ContentEntityForm::isDefaultFormLangcode

public ContentEntityForm::isDefaultFormLangcode(FormStateInterface $form_state)

Checks whether the current form language matches the entity one.

Parameters

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

Return value

bool Returns TRUE if the entity form language matches the entity one.

Overrides ContentEntityFormInterface::isDefaultFormLangcode

File

core/lib/Drupal/Core/Entity/ContentEntityForm.php, line 213

Class

ContentEntityForm
Entity form variant for content entity types.

Namespace

Drupal\Core\Entity

Code

public function isDefaultFormLangcode(FormStateInterface $form_state) {
  $this->initFormLangcodes($form_state);
  return $form_state->get('langcode') == $form_state->get('entity_default_langcode');
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Entity!ContentEntityForm.php/function/ContentEntityForm::isDefaultFormLangcode/8.1.x