You are here

public function FormModeManager::isActive in Form mode manager 8

Same name and namespace in other branches
  1. 8.2 src/FormModeManager.php \Drupal\form_mode_manager\FormModeManager::isActive()

Determine if a form mode is activated onto bundle of specific entity.

Parameters

string $entity_type_id: The entity type id.

string $bundle_id: Name of bundle for current entity.

string $form_mode_machine_name: Machine name of form mode.

Return value

bool True if FormMode is activated on needed bundle.

Overrides FormModeManagerInterface::isActive

2 calls to FormModeManager::isActive()
FormModeManager::getActiveDisplaysByBundle in src/FormModeManager.php
Gets the entity form mode info for a specific bundle.
FormModeManager::hasActiveFormMode in src/FormModeManager.php
Determine if current entity_type has one bundle implement this mode.

File

src/FormModeManager.php, line 228

Class

FormModeManager
FormDisplayManager service.

Namespace

Drupal\form_mode_manager

Code

public function isActive($entity_type_id, $bundle_id, $form_mode_machine_name) {
  $form_mode_active = array_keys($this->entityDisplayRepository
    ->getFormModeOptionsByBundle($entity_type_id, $bundle_id));
  return in_array($form_mode_machine_name, $form_mode_active);
}