protected function prepareTemplateAssets(
        TemplateDefinition $templateDefinition,
        $assets_directory,
        SmartyParser $smartyParser
    ) {
        // Get the registered template directories for the current template type
        $templateDirectories = $smartyParser->getTemplateDirectories($templateDefinition->getType());

        // Use the template name first
        $templateDefinitionList = array_merge(
            [ $templateDefinition ],
            $templateDefinition->getParentList()
        );

        // Prepare assets for all template hierarchy.
        // Copy current template assets and its parents assets to the web/assets directory

        /** @var TemplateDefinition $templateDefinitionItem */
        foreach ($templateDefinitionList as $templateDefinitionItem) {
            // Use also the parent directories
            if (isset($templateDirectories[$templateDefinitionItem->getName()])) {
                /* create assets foreach registered directory : main @ modules */
                foreach ($templateDirectories[$templateDefinitionItem->getName()] as $key => $directory) {
                    // This is the assets directory in the template's tree
                    $tpl_path = $directory . DS . $assets_directory;

                    if (false !== $asset_dir_absolute_path = realpath($tpl_path)) {
                        $this->assetsManager->prepareAssets(
                            $asset_dir_absolute_path,
                            $this->web_root . $this->path_relative_to_web_root,
                            $templateDefinitionItem->getPath(),
                            $key . DS . $assets_directory
                        );
                    }
                }
            }
        }
    }