ezsystems/ezpublish-kernel
eZ Publish Kernel is the core of the eZ Publish/eZ Platform CMS, providing the content repository, field types, search integration, and services for building and extending PHP-based content applications with a modular, API-driven architecture.
Audience: integrators, extension developers Author: Bertrand Dunogier bertrand.dunogier@ez.no Created: 22/01/2014 JIRA story: https://jira.ez.no/browse/EZP-22210 Topics: BC, Extensibility
Make it possible to ship legacy extensions in a Symfony 2 bundle.
Bundles can provide legacy extensions in two ways:
Legacy extensions are stored within the bundle, in an ezpublish_legacy folder.
Each extension has its own subdirectory containing at least an extension.xml file.
If a legacy extension already exists, it can be added to the bundle's composer.json file as a requirement. To automatically enable such an extension, the bundle's class must implement eZ\Bundle\EzPublishLegacyBundle\LegacyBundles\LegacyBundleInterface, and return the legacy extension name in an array.
# vendor/acme/LegacyBundle/composer.json
"requires:" {
"acme/acmeextension": "~1.0"
}
// vendor/acme/LegacyBundle/AcmeLegacyBundle.php
namespace Acme\LegacyBundle;
use eZ\Bundle\EzPublishLegacyBundle\LegacyBundles\LegacyBundleInterface;
class AcmeLegacyBundle implements LegacyBundleInterface
{
public function getLegacyExtensionsNames()
{
return array( 'acmeextension' );
}
}
The developer of a custom extension, like a fieldtype, wants to make his extension available via composer, and add preliminary new stack support to it. He creates a new bundle for his extension, and copies all of its contents to Resources/ezpublish-legacy.
Anyone can install his legacy extension by requiring it from composer.json. The custom install script will link it into his legacy extensions folder, and enable it when the bundle is enabled.
A project's maintainer wants to gather as much as possible of his project elements into one place.
Any setting that isn't mapped by the semantical configuration can be overridden using the Resources/ezpublish-legacy folder, using the standard settings/override and settings/siteaccess folder. Custom legacy templates can also be created here, for instance to override a couple backoffice elements.
Since there is no backoffice yet, a couple legacy elements are still required (datatype class, edit/view templates, settings. Using a Bundle, the developer can have both the new stack and legacy code in the same structure, and make sure both evolve at the same rythm:
Acme/Bundle/AcmeBundle/ezpublish_legacy/acmefieldtype contains the legacy datatype extensionAcme/Bundle/AcmeBundle/eZ/FieldType contains the new stack implementationIf a new stack feature requires custom items in the backoffice, like a content tab, or custom templates, a legacy bundle can be used to keep those elements along with the bundle, and have it automatically installed & enabled as long as the bundle is registered.
ezpublish_legacy.legacy_bundles_extensions is merged into injected INI settings to site.ini/ExtensionSettings/ActiveExtensions by a LegacyMapper eventThe script, ezpublish:legacybundles:install_extensions, will symlink into ezpublish_legacy/extensions all extension directories returned by the scanner.
--force option is used--force option is set, any existing target will be removed before creating the link.The script is executed by composer at post-update/post-install.
Legacy bundles extension directories are scanned as follows:
ezpublish_legacy folder, containing subfolders with an extension.xml file.The list of actual legacy extensions is the basename() of all extension directories found in the bundles. Additional extensions names can be specified without a physical extension directory. If a bundle implements eZ\Bundle\EzPublishLegacyBundle\LegacyBundles\LegacyBundleInterface, the getLegacyExtensionsNames custom method will be called on it. It must return an array of legacy extension names that need to be enabled.
Extensions names from those bundles are returned by the interface method implemented by the bundle.
Parameter name: ezpublish_legacy.legacy_bundles_extensions.
Injected settings: site.ini/ExtensionSettings/ActiveExtensions.
How can I help you explore Laravel packages today?