WizardParameters.php in Flexiform 8
File
contrib/wizard/src/Plugin/FormEnhancer/WizardParameters.php
View source
<?php
namespace Drupal\flexiform_wizard\Plugin\FormEnhancer;
use Drupal\flexiform\FormEnhancer\FormEnhancerBase;
class WizardParameters extends FormEnhancerBase {
public function applies($event) {
if ($event != 'init_form_entity_config') {
return FALSE;
}
return substr($this
->getFormDisplay()
->id(), 0, 17) == 'flexiform_wizard.';
}
public function initFormEntityConfig() {
list(, $wizard_id, $step) = explode('.', $this
->getFormDisplay()
->id(), 3);
$wizard = entity_load('flexiform_wizard', $wizard_id);
$form_entity_settings = [];
foreach ($wizard
->get('parameters') as $param_name => $param_info) {
$form_entity_settings[$param_name] = [
'entity_type' => $param_info['entity_type'],
'bundle' => $param_info['bundle'],
'plugin' => 'provided',
'label' => $param_info['label'],
];
}
return $form_entity_settings;
}
}
Classes
Name |
Description |
WizardParameters |
Plugin for adding Wizard Parameters into the Flexiform entity manager. |