src/web/Blocks.php
public function process_block_assets($block_name, $parent_block, $depends): void {

        if (isset($this->_used_blocks[$block_name]))
            return;

        $block_path = $this->get_block_path($block_name);

        foreach ($this->libraries as $base_path) {

            if (is_dir($base_path . $block_path . 'assets')) {
                $this->_build_assets_dir($block_name, $base_path . $block_path . 'assets');
                break;
            }
        }

        if (!empty($depends)) {
            foreach ($depends as $depend) {
                if (isset($this->_used_blocks[$depend])) {
                    continue;
                }
                $this->process_block_assets($depend, $parent_block, $this->_blocks[$depend]->_depends);
                $this->_used_blocks[$depend] = true;
            }
        }
        $types = ['css', 'js'];

        foreach ($types as $type) {
            foreach ($this->libraries as $base_path) {

                if (is_file($base_path . $block_path . $block_name . '.' . $type)) {
                    $this->_files[$type][$parent_block]['files'][$block_name . '.' . $type] = $base_path . $block_path . $block_name . '.' . $type;
                    break;
                }
            }
        }

        if ($this->_blocks[$block_name]->__remote_js !== null) {
            foreach ($this->_blocks[$block_name]->__remote_js as $link => $settings) {
                if (!empty($settings) AND isset($settings['position'])) {
                    $position = $settings['position'];
                    unset($settings['position']);
                } else {
                    $position = Blocks::END;;
                }
                $this->_files['js'][$parent_block]['remote'][$position][] = HTML::script($link, $settings);
            }
        }

        if ($this->_blocks[$block_name]->__remote_css !== null) {
            if (!isset($this->_files['css'][$parent_block]['remote']))
                $this->_files['css'][$parent_block]['remote'] = [];

            foreach ($this->_blocks[$block_name]->__remote_css as $link) {
                $this->_files['css'][$parent_block]['remote'][] = $link;
            }
        }

        if (!empty($this->_blocks[$block_name]->__inline_js)) {

            foreach ($this->_blocks[$block_name]->__inline_js as $inline) {
                $position = (!empty($inline[1]) AND isset($inline[1]['position'])) ? $inline[1]['position'] : Blocks::END;
                if (!isset($this->_files['js'][$parent_block]['inline'][$position]))
                    $this->_files['js'][$parent_block]['inline'][$position] = [];
                $this->_files['js'][$parent_block]['inline'][$position][] = $inline[0];
            }
        }

        if (!empty($this->_blocks[$block_name]->__inline_css)) {
            if (!isset($this->_files['css'][$parent_block]['inline']))
                $this->_files['css'][$parent_block]['inline'] = $this->_blocks[$block_name]->__inline_css;
            else
                $this->_files['css'][$parent_block]['inline'] = array_merge($this->_files['.css'][$parent_block]['inline'], $this->_blocks[$block_name]->__inline_css);
        }
    }
public function process_block_assets($block_name, $parent_block, $depends): void {

        if (isset($this->_used_blocks[$block_name]))
            return;

        $block_path = $this->get_block_path($block_name);

        foreach ($this->libraries as $base_path) {

            if (is_dir($base_path . $block_path . 'assets')) {
                $this->_build_assets_dir($block_name, $base_path . $block_path . 'assets');
                break;
            }
        }

        if (!empty($depends)) {
            foreach ($depends as $depend) {
                if (isset($this->_used_blocks[$depend])) {
                    continue;
                }
                $this->process_block_assets($depend, $parent_block, $this->_blocks[$depend]->_depends);
                $this->_used_blocks[$depend] = true;
            }
        }
        $types = ['css', 'js'];

        foreach ($types as $type) {
            foreach ($this->libraries as $base_path) {

                if (is_file($base_path . $block_path . $block_name . '.' . $type)) {
                    $this->_files[$type][$parent_block]['files'][$block_name . '.' . $type] = $base_path . $block_path . $block_name . '.' . $type;
                    break;
                }
            }
        }

        if ($this->_blocks[$block_name]->__remote_js !== null) {
            foreach ($this->_blocks[$block_name]->__remote_js as $link => $settings) {
                if (!empty($settings) AND isset($settings['position'])) {
                    $position = $settings['position'];
                    unset($settings['position']);
                } else {
                    $position = Blocks::END;;
                }
                $this->_files['js'][$parent_block]['remote'][$position][] = HTML::script($link, $settings);
            }
        }

        if ($this->_blocks[$block_name]->__remote_css !== null) {
            if (!isset($this->_files['css'][$parent_block]['remote']))
                $this->_files['css'][$parent_block]['remote'] = [];

            foreach ($this->_blocks[$block_name]->__remote_css as $link) {
                $this->_files['css'][$parent_block]['remote'][] = $link;
            }
        }

        if (!empty($this->_blocks[$block_name]->__inline_js)) {

            foreach ($this->_blocks[$block_name]->__inline_js as $inline) {
                $position = (!empty($inline[1]) AND isset($inline[1]['position'])) ? $inline[1]['position'] : Blocks::END;
                if (!isset($this->_files['js'][$parent_block]['inline'][$position]))
                    $this->_files['js'][$parent_block]['inline'][$position] = [];
                $this->_files['js'][$parent_block]['inline'][$position][] = $inline[0];
            }
        }

        if (!empty($this->_blocks[$block_name]->__inline_css)) {
            if (!isset($this->_files['css'][$parent_block]['inline']))
                $this->_files['css'][$parent_block]['inline'] = $this->_blocks[$block_name]->__inline_css;
            else
                $this->_files['css'][$parent_block]['inline'] = array_merge($this->_files['.css'][$parent_block]['inline'], $this->_blocks[$block_name]->__inline_css);
        }
    }
Recursively process a block and its dependencies

@param $block_name