You are here

public function Cookie::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/Cookie.php, line 96

Class

Cookie
Plugin to capture browser cookies and send them to pardot.

Namespace

Drupal\pardot\Plugin\PardotFormMapFormatterPlugin

Code

public function getFormattedValue(FormStateInterface $form_state) {
  $cookies = $this->requestStack
    ->getCurrentRequest()->cookies;
  $cookie_name = $this
    ->getConfiguration()['cookie_name'];
  if ($cookie_name) {
    return $cookies
      ->get($cookie_name, '');
  }
  return NULL;
}