public function AutoPath::getFormattedValue in Pardot Integration 2.x
Get the form field from the form state and apply formatting.
Parameters
\Drupal\Core\Form\FormStateInterface $form_state: The form state that holds the input values.
Return value
mixed The formatted value or null i guess.
File
- src/
Plugin/ PardotFormMapFormatterPlugin/ AutoPath.php, line 104
Class
- AutoPath
- Plugin to have an autocomplete textfield for typed data.
Namespace
Drupal\pardot\Plugin\PardotFormMapFormatterPluginCode
public function getFormattedValue(FormStateInterface $form_state) {
/** @var \Drupal\contact\Entity\Message $form_entity */
$form_entity = $form_state
->getFormObject()
->getEntity();
$path = $this
->getConfiguration()['path'] ?? '';
if ($path) {
$path = explode('.', $path);
array_shift($path);
$path = implode('.', $path);
$value = $this->dataFetcher
->fetchDataByPropertyPath($form_entity
->getTypedData(), $path)
->getValue();
return $value;
}
return NULL;
}