Пример #1
0
 /**
  * The only "layout" needed in the case of the WP admin is to wrap the page
  * content with the wpWrap() view helper, which applies some basic structure
  * to WP admin pages and wraps everything in the .bootstrap-wrapper class so
  * that bootstrap styles can work without conflicting with WP styles.
  *
  * @param string $content
  * @param HeadScript $headScript
  * @param HeadLink $headLink
  * @return string
  */
 public function renderLayout($content, HeadScript $headScript = null, HeadLink $headLink = null)
 {
     global $wp_version;
     $view = new View();
     $output = $view->wpWrap()->open();
     $output .= $content;
     $output .= $view->wpWrap()->close();
     foreach ($headScript as $script) {
         // We're prefixing the name here so we don't conflict with WP names
         wp_enqueue_script('dewdrop-' . basename($script->attributes['src'], '.js'), $script->attributes['src'], [], $wp_version, true);
     }
     foreach ($headLink as $link) {
         if ('stylesheet' === $link->rel) {
             wp_enqueue_style('dewdrop-' . basename($link->href, '.css'), $link->href);
         }
     }
     return $output;
 }