How to use the twig.placeholders function in twig

To help you get started, we’ve selected a few twig examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github shopware / platform / src / Administration / Resources / administration / src / core / factory / template.factory.js View on Github external
template.baseTemplate = firstOverride;
            } else {
                warn(componentName, 'has no overrides or template to extend from!');
                return '';
            }
        } else {
            warn('missing baseTemplate', componentName);
            return '';
        }
    }

    /**
     * The base template is the main template of the component.
     */
    const { baseTemplate, overrides } = template;
    const parentPlaceholder = Twig.placeholders.parent;
    const blocks = {};

    /**
     * Iterate through template extensions and collect all block overrides.
     */
    if (overrides) {
        overrides.forEach((override) => {
            const templateBlocks = override.render({}, {
                output: 'blocks'
            });

            /**
             * Replace the parent placeholder with the parent block.
             * This ensures multi level inheritance.
             */
            Object.keys(blocks).forEach((blockName) => {