Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2014
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. 'aliases' => array(
  2. 'FrontendAssets' => 'LibFrontendAssets',
  3. )
  4.  
  5. class FrontendAssets
  6. {
  7. /**
  8. * Styles array to include on every admin page
  9. * @var array
  10. */
  11. protected static $styles = [];
  12. /**
  13. * Scripts array to include on every admin page
  14. * @var array
  15. */
  16. protected static $scripts = [];
  17.  
  18. public static function styles()
  19. {
  20. return static::assets(static::$styles);
  21. }
  22.  
  23. public static function addStyle($style)
  24. {
  25. static::$styles[] = $style;
  26. }
  27.  
  28. public static function scripts()
  29. {
  30. $scripts = static::assets(static::$scripts);
  31.  
  32. return $scripts;
  33. }
  34.  
  35. public static function addScript($script)
  36. {
  37. static::$scripts[] = $script;
  38. }
  39.  
  40. /**
  41. * @param $assets
  42. * @return array
  43. */
  44. public static function assets($assets)
  45. {
  46. return array_map(function ($asset)
  47. {
  48. return $asset;
  49. }, array_unique($assets));
  50. }
  51. }
  52.  
  53. FrontendAssets::assets();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement