Data assignment
You can simply pass data to any object or template with the configuration file: packages/Acme/etc/config.php
<?php
$config = [
Core_Block::TYPE => [
'default' => [
'scope' => 'I\'m available in all blocks of the "Acme" package',
],
'banner' => [
'scope' => 'I\'m available in the block "banner" of the "Acme" package',
],
],
];
The data will be available in class or template file with the getData method or the magic getter:
<?php
$this->getData('scope');
// or
$this->getScope();
Use global configuration file to set data to packages and objects according the environment: etc/config.{MW_ENVIRONMENT}.php
<?php
$config = [
'default' => [ // All packages
'default' => [
'default' => [
'scope' => 'I\'m available everywhere in all packages for the current environment',
],
],
Core_Page::TYPE => [
'default' => [
'scope' => 'I\'m available in all pages of all packages for the current environment',
],
],
Core_Block::TYPE => [
'banner' => [
'scope' => 'I\'m available in the block "banner" of all packages for the current environment',
],
],
],
];
Overload hierarchy:
- default.default.default
- default.default.{identifier}
- default.{type}.default
- default.{type}.{identifier}
- {package}.default.default
- {package}.default.{identifier}
- {package}.{type}.default
- {package}.{type}.{identifier}
- Installation
- Configuration
- Add a new package
- Add a new HTML page
- Serve any type of file
- Rewrite a route
- Add a new block
- Data assignment
- Objects and class fallback
- Database
- Console Commands
- Framework tools
- Custom shared libraries
- External libraries with composer
- Templating best practices
- Forms
- Captcha
- Write content in Markdown
- Static Site Generator