Skip to content
This repository has been archived by the owner on Apr 6, 2020. It is now read-only.

This extension provides an import interface so that other extension can propose assets being imported.

Notifications You must be signed in to change notification settings

netzmacht-archive/contao-theme-plus-importer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Theme Plus Importer

This extension provides an import feature for the great Theme+ extension for Contao. 3rd party extension can use Theme Plus Importer to easily integrate their assets into Theme+.

The extension integrates an import dialog in the Theme+ stylesheets and javascripts page:

Install

Theme Plus importer can be installed using the composer repository: netzmacht/contao-theme-plus-importer

You have to install it manually at the moment. Installing by composer is on the roadmap.

Import types

The importer auto detects which type the asset has. It detects urls (beginning with http://, https:// or //) and files. The different file sources of Theme+ are supported as well (files, assets or system/modules).

Add assets using the config files

Extensions can define their assets using the config vars.

<?php

// import javascripts
$GLOBALS['THEME_PLUS_IMPORT_JAVASCRIPTS']['package-name'][] 'path/to/javascripts.js';

// import stylesheets
$GLOBALS['THEME_PLUS_IMPORT_STYLESHEETS']['package-name'][] 'path/to/style.css';

Add assets using the event dispatcher

Besides assets can be imported by using the event dispatcher. This is useful, if you using some third party libraries where you want to ensure they are installed.

<?php

use Netzmacht\ThemePlusImporter\Event\CollectAssetsEvent;

$GLOBALS['TL_EVENTS'][CollectAssetsEvent::NAME][] = function(CollectAssetsEvent $event) {
    $event->addJavascript('package-name', 'path/to/javascripts.js');
}

Note: If you do not depend on the importer you should use the internal used event name theme-plus-importer.collect-assets instead of the class constant.

About

This extension provides an import interface so that other extension can propose assets being imported.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages