You are here

private function HeartbeatTypeForm::extractMessageArguments in Heartbeat 8

2 calls to HeartbeatTypeForm::extractMessageArguments()
HeartbeatTypeForm::form in src/Form/HeartbeatTypeForm.php
Gets the actual form array to be built.
HeartbeatTypeForm::rebuildMessageArguments in src/Form/HeartbeatTypeForm.php
Custom form validation to rebuild Form field for mapping Message Arguments

File

src/Form/HeartbeatTypeForm.php, line 356

Class

HeartbeatTypeForm
Class HeartbeatTypeForm.

Namespace

Drupal\heartbeat\Form

Code

private function extractMessageArguments($message) {

  //TODO find solution for trailing exclamation marks being wrongly interpreted

  //ie parse each word in string and reconstruct string prior to exploding it on

  //exclamation marks again
  $messageArguments = array_slice(explode('!', $message), 1);
  $argsArray = array();
  foreach ($messageArguments as $argument) {
    if (strlen($argument) > 0) {
      $cleanArgument = strpos($argument, ' ') ? substr($argument, 0, strpos($argument, ' ')) : $argument;
      $argsArray[] = $cleanArgument;
      $this->messageMap[] = '!' . $cleanArgument;
    }
  }
  return $argsArray;
}