You are here

function animate_any_page_attachments in Animate Any 8

File

./animate_any.module, line 90

Code

function animate_any_page_attachments(&$page) {
  $connection = \Drupal::database();
  $fetch = $connection
    ->select("animate_any_settings", "a");
  $fetch
    ->fields('a');
  $fetch_results = $fetch
    ->execute()
    ->fetchAll();
  $json_data = json_encode($fetch_results);

  // Pass json variable to animate_any.js.
  $page['#attached']['library'][] = 'animate_any/animate';
  $page['#attached']['drupalSettings']['animate']['animation_data'] = $json_data;
}