Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'aliases' => array(
- 'FrontendAssets' => 'LibFrontendAssets',
- )
- class FrontendAssets
- {
- /**
- * Styles array to include on every admin page
- * @var array
- */
- protected static $styles = [];
- /**
- * Scripts array to include on every admin page
- * @var array
- */
- protected static $scripts = [];
- public static function styles()
- {
- return static::assets(static::$styles);
- }
- public static function addStyle($style)
- {
- static::$styles[] = $style;
- }
- public static function scripts()
- {
- $scripts = static::assets(static::$scripts);
- return $scripts;
- }
- public static function addScript($script)
- {
- static::$scripts[] = $script;
- }
- /**
- * @param $assets
- * @return array
- */
- public static function assets($assets)
- {
- return array_map(function ($asset)
- {
- return $asset;
- }, array_unique($assets));
- }
- }
- FrontendAssets::assets();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement