You are here

public function FormModeManager::candidateToExclude in Form mode manager 8.2

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

Evaluate if current form_mode is candidate to be filtered or not.

Parameters

array $form_mode: A form mode definition.

string $entity_type_id: The entity type id.

bool $ignore_excluded: Joker to determine if form modes to exclude list are used or ignored.

Return value

bool True if form mode is candidate to be excluded or False if not.

Overrides FormModeManagerInterface::candidateToExclude

1 call to FormModeManager::candidateToExclude()
FormModeManager::filterExcludedFormModes in src/FormModeManager.php
Filter a form mode collection to exclude all desired form mode id.

File

src/FormModeManager.php, line 159

Class

FormModeManager
FormDisplayManager service.

Namespace

Drupal\form_mode_manager

Code

public function candidateToExclude(array $form_mode, $entity_type_id, $ignore_excluded) {
  $is_excluded = TRUE;
  if (!$this
    ->isValidFormMode($form_mode)) {
    return $is_excluded;
  }
  if ($entity_type_id === $form_mode['targetEntityType']) {
    $is_excluded = FALSE;
  }
  if (!$ignore_excluded && $this
    ->formModeIsExcluded($this
    ->getFormModeExcluded($entity_type_id), $this
    ->getFormModeMachineName($form_mode['id']))) {
    $is_excluded = TRUE;
  }
  return $is_excluded;
}