You are here

public static function PanelizerWizardGeneralForm::validateMachineName in Panelizer 8.4

Same name and namespace in other branches
  1. 8.5 src/Form/PanelizerWizardGeneralForm.php \Drupal\panelizer\Form\PanelizerWizardGeneralForm::validateMachineName()
  2. 8.3 src/Form/PanelizerWizardGeneralForm.php \Drupal\panelizer\Form\PanelizerWizardGeneralForm::validateMachineName()

Parameters

$machine_name:

$element:

File

src/Form/PanelizerWizardGeneralForm.php, line 92

Class

PanelizerWizardGeneralForm
General settings for a panelized bundle.

Namespace

Drupal\panelizer\Form

Code

public static function validateMachineName($machine_name, $element) {

  // Attempt to load via the machine name and entity type.
  if (isset($element['#machine_name']['prefix'])) {
    $panelizer = \Drupal::service('panelizer');

    // Load the panels display variant.
    $full_machine_name = $element['#machine_name']['prefix'] . '__' . $machine_name;
    return $panelizer
      ->getDefaultPanelsDisplayByMachineName($full_machine_name);
  }
}