You are here

public function RefreshPageElementsHelper::updateFormBuildId in Commerce Ajax Add to Cart 8

Updates the form build id.

Parameters

array $form: Drupal form.

Return value

$this

File

src/RefreshPageElementsHelper.php, line 165

Class

RefreshPageElementsHelper
Provides methods that would help in refreshing certain page elements.

Namespace

Drupal\dc_ajax_add_cart

Code

public function updateFormBuildId(array $form) {

  // If the form build ID has changed, issue an Ajax command to update it.
  if (isset($form['#build_id_old']) && $form['#build_id_old'] !== $form['#build_id']) {
    $this->response
      ->addCommand(new UpdateBuildIdCommand($form['#build_id_old'], $form['#build_id']));
  }
  return $this;
}