public function MaestroWebformTask::fetchNodesAttached in Maestro 8.2
Same name and namespace in other branches
- 3.x modules/maestro_webform/src/Plugin/EngineTasks/MaestroWebformTask.php \Drupal\maestro_webform\Plugin\EngineTasks\MaestroWebformTask::fetchNodesAttached()
Ajax callback to validate the Webform selection. Generate a list of nodes it's attached to, if any.
File
- modules/
maestro_webform/ src/ Plugin/ EngineTasks/ MaestroWebformTask.php, line 396
Class
- MaestroWebformTask
- Maestro Webform Task Plugin.
Namespace
Drupal\maestro_webform\Plugin\EngineTasksCode
public function fetchNodesAttached(array &$form, FormStateInterface $form_state) {
$options = $this
->_getAttachedNodeOptions($form_state
->getValue('webform_machine_name'));
$elem = [
'#type' => 'select',
'#options' => $options,
'#title' => $this
->t('Nodes Attached To selected webform'),
'#description' => $this
->t('Enabled when you choose NOT to use a process variable. Listed are the nodes that use the specified webform.'),
'#description_display' => 'after',
'#states' => [
'enabled' => [
':input[name="webform_nodes_attached_variable"]' => [
'value' => 'none',
],
],
],
'#required' => FALSE,
'#prefix' => '<div id="attached-nodes">',
'#suffix' => '</div>',
];
$renderer = \Drupal::service('renderer');
$response = new AjaxResponse();
$response
->addCommand(new ReplaceCommand('#attached-nodes', $renderer
->render($elem)));
return $response;
}