You are here

public function HeartbeatTypeForm::tokenSelectDialog in Heartbeat 8

File

src/Form/HeartbeatTypeForm.php, line 424

Class

HeartbeatTypeForm
Class HeartbeatTypeForm.

Namespace

Drupal\heartbeat\Form

Code

public function tokenSelectDialog(array &$form, FormStateInterface $form_state) {

  // Instantiate an AjaxResponse Object to return.
  $ajax_response = new AjaxResponse();

  // Add a command to execute on form, jQuery .html() replaces content between tags.
  // In this case, we replace the description with whether the username was found or not.
  //    $ajax_response->addCommand(new HtmlCommand('#token-tree', $output));
  // CssCommand did not work.

  //$ajax_response->addCommand(new CssCommand('#edit-user-name--description', array('color', $color)));

  //    $color = 'pink';
  // Add a command, InvokeCommand, which allows for custom jQuery commands.
  // In this case, we alter the color of the description.
  $ajax_response
    ->addCommand(new InvokeCommand('.token-tree', 'css', array(
    'display',
    'block',
  )));
  $this->treeAdded = TRUE;

  // Return the AjaxResponse Object.
  return $ajax_response;
}