Download the PHP package fiedsch/contao-components without Composer
On this page you can find all versions of the php package fiedsch/contao-components. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download fiedsch/contao-components
More information about fiedsch/contao-components
Files in fiedsch/contao-components
Package contao-components
Short Description additional components for Contao Open Source CMS
License MIT
Informations about the package contao-components
Components for Contao
Abandoned! Please use fiedsch/contao-jsonwidget
instead.
Widgets
JSON widget
The jsonWidget
can be used in DCA files to create a text field that contains a JSON string.
While saving it will be checked if that the string is valid JSON.
The widget displays the JSON string with JSON_PRETTY_PRINT
so that checks by the reader are are easier.
Example: extending Members
Other valid options in eval
are the same as for textarea
s (as WidgetJSON
extends TextArea
),
except that setting rte
will be ignored because the editors provided do not make sense here.
How to use that?
Extend tl_member
as in the above example. Then create an ExtendedMemberModel
that
extends Contao's MemberModel
. In the magic methodd __set()
and _get
you can intercept
the "fields" stored in json_data
. The Fiedsch\JsonGetterSetterTrait
takes care of that:
And finally ...
Helper Classes
Reading YAML config files (mostly experimental)
If files/config/config.yml
does not exist it will be created with
the data specified in (the optional parameter) $defaults
:
Use the YamlConfigHelper
instance $config
like so:
Let's say that as expected files/config/config.yaml
exists and contains
You would get
with the data in $defaults
being ignored. There will be no merge of what is read from
the config file and the specified $defaults
!
For details using Symfony's ExpressionLanguage
see
http://symfony.com/doc/current/components/expression_language.html
Specifying a default
With the config data as above:
Data types
with the configuration file as above
returns a stdClass
Instance. If you need the data as an array
, you have to type cast to array
Please note
Using
please note that file.yaml
is publicly accessible (in Contao 3) unless some folder
along the path files/sompe/path/to/a/
is protected by a .htaccess file
(the lock
icon in the Contao backend).
If you want to make the file editable for Contao backend users:
- place it in (a folder below)
files/
- make the file extension
.yaml
so Contaos syntax highlighting will be triggered (which will not happen with a.yml
extension) - add
yaml
to Contaos list of "editable file types" (found in System, Settings)
All versions of contao-components with dependencies
contao/core-bundle Version ~3.5 || ~4.4
contao-community-alliance/composer-plugin Version ~2.4 || ~3.0
symfony/yaml Version ~2.7 || ~2.8 || ~3.2 || ~3.4
symfony/expression-language Version ~2.7 || ~2.8 || ~3.2 || ~3.4