public static function assets($currentPage, $fields)
    {
        global $pagenow;

        // Check current page
        if (empty($fields) || !in_array($pagenow, $currentPage)) {
            return;
        }

        $assets = [
            'scripts' => [],
            'styles' => [],
        ];

        /**
         * Add your custom assets to make them accessible.
         *
         * @param   array $paths
         * @return  array $paths
         */
        $paths = apply_filters('ol_zeus_render_assets', []);

        // Iterate on fields to render assets
        if (!empty($fields)) {
            foreach ($fields as $field) {
                if (!$field) {
                    continue;
                }

                $paths = array_merge($paths, $field->renderAssets());
            }
        }

        // Check paths
        if (empty($paths)) {
            return;
        }

        // Create temp accessible files and update assets
        foreach ($paths as $name => $path) {
            self::assetsInCache($path, $name);
            $type = 'js/' === substr($name, 0, 3) ? 'scripts' : 'styles';

            $assets[$type][] = [
                'name' => $name,
                'file' => OL_ZEUS_URI.$name,
            ];
        }

        // Add all in admin panel
        add_action('admin_enqueue_scripts', function ($hook) use ($assets) {
            // Scripts
            if (!empty($assets['scripts'])) {
                foreach ($assets['scripts'] as $script) {
                    wp_enqueue_script($script['name'], $script['file'], ['jquery']);
                }
            }

            // Styles
            if (!empty($assets['styles'])) {
                $handle = wp_style_is('olympus-core-css', 'registered') ? 'olympus-core-css' : false;

                foreach ($assets['styles'] as $style) {
                    wp_enqueue_style($style['name'], $style['file'], $handle);
                }
            }
        }, 9);
    }
public static function assets($currentPage, $fields)
    {
        global $pagenow;

        // Check current page
        if (empty($fields) || !in_array($pagenow, $currentPage)) {
            return;
        }

        $assets = [
            'scripts' => [],
            'styles' => [],
        ];

        /**
         * Add your custom assets to make them accessible.
         *
         * @param   array $paths
         * @return  array $paths
         */
        $paths = apply_filters('ol_zeus_render_assets', []);

        // Iterate on fields to render assets
        if (!empty($fields)) {
            foreach ($fields as $field) {
                if (!$field) {
                    continue;
                }

                $paths = array_merge($paths, $field->renderAssets());
            }
        }

        // Check paths
        if (empty($paths)) {
            return;
        }

        // Create temp accessible files and update assets
        foreach ($paths as $name => $path) {
            self::assetsInCache($path, $name);
            $type = 'js/' === substr($name, 0, 3) ? 'scripts' : 'styles';

            $assets[$type][] = [
                'name' => $name,
                'file' => OL_ZEUS_URI.$name,
            ];
        }

        // Add all in admin panel
        add_action('admin_enqueue_scripts', function ($hook) use ($assets) {
            // Scripts
            if (!empty($assets['scripts'])) {
                foreach ($assets['scripts'] as $script) {
                    wp_enqueue_script($script['name'], $script['file'], ['jquery']);
                }
            }

            // Styles
            if (!empty($assets['styles'])) {
                $handle = wp_style_is('olympus-core-css', 'registered') ? 'olympus-core-css' : false;

                foreach ($assets['styles'] as $style) {
                    wp_enqueue_style($style['name'], $style['file'], $handle);
                }
            }
        }, 9);
    }
public static function assets ( $ currentPage , $ fields ) { global $ pagenow ; // Check current page if ( empty ( $ fields ) || ! in_array ( $ pagenow , $ currentPage ) ) { return ; } $ assets = [ 'scripts' => [ ] , 'styles' => [ ] , ] ; /**
         * Add your custom assets to make them accessible.
         *
         * @param   array $paths
         * @return  array $paths
         */ $ paths = apply_filters ( 'ol_zeus_render_assets' , [ ] ) ; // Iterate on fields to render assets if ( ! empty ( $ fields ) ) { foreach ( $ fields as $ field ) { if ( ! $ field ) { continue ; } $ paths = array_merge ( $ paths , $ field -> renderAssets ( ) ) ; } } // Check paths if ( empty ( $ paths ) ) { return ; } // Create temp accessible files and update assets foreach ( $ paths as $ name => $ path ) { self :: assetsInCache ( $ path , $ name ) ; $ type = 'js/' === substr ( $ name , 0 , 3 ) ? 'scripts' : 'styles' ; $ assets [ $ type ] [ ] = [ 'name' => $ name , 'file' => OL_ZEUS_URI . $ name , ] ; } // Add all in admin panel add_action ( 'admin_enqueue_scripts' , function ( $ hook ) use ( $ assets ) { // Scripts if ( ! empty ( $ assets [ 'scripts' ] ) ) { foreach ( $ assets [ 'scripts' ] as $ script ) { wp_enqueue_script ( $ script [ 'name' ] , $ script [ 'file' ] , [ 'jquery' ] ) ; } } // Styles if ( ! empty ( $ assets [ 'styles' ] ) ) { $ handle = wp_style_is ( 'olympus-core-css' , 'registered' ) ? 'olympus-core-css' : false ; foreach ( $ assets [ 'styles' ] as $ style ) { wp_enqueue_style ( $ style [ 'name' ] , $ style [ 'file' ] , $ handle ) ; } } } , 9 ) ; }
Render assets on asked page.

@param array $currentPage
@param array $fields
Render assets on asked page .