You are here

function getLabelFormModeFromMachineName in Form Mode Control 8

Parameters

$entity_type:

$bundle:

$display_searched:

Return value

mixed

1 call to getLabelFormModeFromMachineName()
FormModeConfigForm::filterFormModeByEntityType in src/Form/FormModeConfigForm.php
Filter form modes which have permission by entity type, bundle.

File

./form_mode_control.module, line 216

Code

function getLabelFormModeFromMachineName($entity_type, $bundle, $display_searched) {
  $displays = \Drupal::entityManager()
    ->getFormModeOptionsByBundle($entity_type, $bundle);
  foreach ($displays as $machine_name_display => $label_display) {
    if (is_object($label_display) && $display_searched == $machine_name_display) {
      return $label_display
        ->render();
    }
    else {
      if (!is_object($label_display) && $display_searched == $machine_name_display) {
        return $label_display;
      }
    }
  }
}