Example #1
0
 /**
  * Enqueue the core Dewdrop client-side dependencies early in the process,
  * before the page is dispatched, so that they come before the page-specific
  * scripts.
  *
  * @param View $view
  * @return void
  */
 protected function enqueueClientSideDependencies(View $view)
 {
     global $wp_version;
     // Use jQuery and Backbone from WP core
     wp_enqueue_script('jquery-core');
     wp_enqueue_script('wp-backbone');
     $wpCoreScripts = array('jquery', 'backbone');
     // Enqueue non-WP core scripts
     foreach ($this->coreClientSideDependencies['js'] as $name => $script) {
         if (!in_array($name, $wpCoreScripts)) {
             wp_enqueue_script($name, $view->bowerUrl($script), ['jquery', 'wp-backbone'], $wp_version, true);
         }
     }
     wp_enqueue_style('bootstrap', $view->bowerUrl('/dewdrop/www/css/bootstrap-wp.css'));
     foreach ($this->coreClientSideDependencies['css'] as $name => $css) {
         // We need to use a special, prefixed version of the Bootstrap CSS for WP
         if ('bootstrap' !== $name) {
             wp_enqueue_style($name, $view->bowerUrl($css));
         }
     }
     wp_enqueue_style('dewdrop-admin-wp', $view->bowerUrl('/dewdrop/www/css/admin-wp.css'));
 }