class PluginSubFormHelpers in Pardot Integration 2.x
Provides an interface for defining Pardot Form Map entities.
Hierarchy
- class \Drupal\pardot\PluginSubFormHelpers
Expanded class hierarchy of PluginSubFormHelpers
2 files declare their use of PluginSubFormHelpers
- PardotFormMappingForm.php in src/
Form/ PardotFormMappingForm.php - WebformSubmissionValue.php in src/
Plugin/ PardotFormMapFormatterPlugin/ WebformSubmissionValue.php
File
- src/
PluginSubFormHelpers.php, line 12
Namespace
Drupal\pardotView source
class PluginSubFormHelpers {
/**
* Help Submit plugin forms.
*
* @param \Drupal\Core\Plugin\PluginFormInterface $plugin
* The plugin instance.
* @param array $form
* The form for creating the subform.
* @param \Drupal\Core\Form\FormStateInterface $form_state
* The form state to use for creating the subform state.
* @param array $parents
* The array parent. Where to get the plugin instance form.
*
* @return array|\Drupal\Core\Plugin\PluginFormInterface
* Either return the plugin or an empty array.
*/
public static function pluginSubmit($plugin, array &$form, FormStateInterface $form_state, array $parents) {
if ($plugin instanceof PluginFormInterface) {
if (!($plugin_form = NestedArray::getValue($form, $parents))) {
$plugin_form = [];
}
$plugin_form_state = SubformState::createForSubform($plugin_form, $form, $form_state);
$plugin
->submitConfigurationForm($plugin_form, $plugin_form_state);
return $plugin;
}
else {
return [];
}
}
/**
* Help Submit plugin forms.
*
* @param \Drupal\Core\Plugin\PluginFormInterface $plugin
* The plugin instance.
* @param array $form
* The form for creating the subform.
* @param \Drupal\Core\Form\FormStateInterface $form_state
* The form state to use for creating the subform state.
* @param array $parents
* The array parent. Where to get the plugin instance form.
*
* @return array|\Drupal\Core\Plugin\PluginFormInterface
* Either return the plugin or an empty array.
*/
public static function buildPluginForm($plugin, array $form, FormStateInterface $form_state, array $parents) {
if ($plugin instanceof PluginFormInterface) {
if (!($plugin_form = NestedArray::getValue($form, $parents))) {
$plugin_form = [];
}
$plugin_form_state = SubformState::createForSubform($plugin_form, $form, $form_state);
$plugin_form = $plugin
->buildConfigurationForm($plugin_form, $plugin_form_state);
$plugin_form['#tree'] = TRUE;
return $plugin_form;
}
else {
return [];
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
PluginSubFormHelpers:: |
public static | function | Help Submit plugin forms. | |
PluginSubFormHelpers:: |
public static | function | Help Submit plugin forms. |