Closed bricebou closed 6 years ago
Just place it in config/synhigh_conf.yml
(or config/config.yml
if you prefer a single config file) and use onConfigLoaded(&$array)
as before
Ok, thanks for the precision :-)
Is there a documentation about the changes, so I can make my plugin fully compatible without the need of PicoDeprecated plugin ? Is there a way to test if I call function that are no longer in use ?
Sure, just refer to http://phrozenbyte.github.io/Pico/in-depth/upgrade-pico-20/ for changes that mostly affect users, and https://github.com/picocms/Pico/blob/pico-1.1/CHANGELOG.md for the full changelog, including all changes relevant for developers. You can disable Pico's PicoDeprecated
plugin by adding PicoDeprecated.enabled: false
to your config/config.yml
.
Ok, thanks for this. I've just looked to this old development and I was wondering if I'm right. Two questions:
$config['synhigh']['theme'] = 'Emacs';
$config['synhigh']['autoloader'] = true;
In YAML, will it be that ?
synhigh:
theme: 'Emacs'
autoloader: true
$config['synhigh']['autobrush'] = array(
'bash shell' => 'Bash',
'txt plain text' => 'Plain',
'js jscript javascript' => 'JScript',
'tex latex' => 'Latex',
'php' => 'Php',
'xml xhtml xslt html' => 'Xml'
);
Will it be:
synhigh:
theme: 'Emacs'
autoloader: true
autobrush: ['bash shell' => 'Bash',
'txt plain text' => 'Plain',
'js jscript javascript' => 'JScript',
'tex latex' => 'Latex',
'php' => 'Php',
'xml xhtml xslt html' => 'Xml']
Thanks again !
synhigh:
theme: Emacs
autoloader: true
autobrush:
"bash shell": Bash
"txt plain text": Plain
"js jscript javascript": JScript
"tex latex": Latex
"php": Php
"xml xhtml xslt html": Xml
Thanks !
But, I still have an issue... with this part:
$config['synhigh']['brush'] = array(
'Bash',
'Plain',
'JScript',
'Latex',
'Php',
'Xml'
);
synhigh:
brush:
"Bash"
"Plain"
"JScript"
"Latex"
"Php"
"Xml"
with or without quotes, I have a PHP Fatal error..
PHP Fatal error: Uncaught Symfony\\Component\\Yaml\\Exception\\ParseException: Unable to parse at line 42 (near ""Bash""). in /home/bbrice/webdev/www-dev/vendor/symfony/yaml/Parser.php:288\nStack trace:\n#0 /home/bbrice/webdev/www-dev/vendor/symfony/yaml/Parser.php(320): Symfony\\Component\\Yaml\\Parser->doParse('"Bash"\\n"Plain"\\n...', false, false, false)\n#1 /home/bbrice/webdev/www-dev/vendor/symfony/yaml/Parser.php(246): Symfony\\Component\\Yaml\\Parser->parseBlock(29, '"Bash"\\n"Plain"\\n...', false, false, false)\n#2 /home/bbrice/webdev/www-dev/vendor/symfony/yaml/Parser.php(320): Symfony\\Component\\Yaml\\Parser->doParse(Array, false, false, false)\n#3 /home/bbrice/webdev/www-dev/vendor/symfony/yaml/Parser.php(246): Symfony\\Component\\Yaml\\Parser->parseBlock(9, 'theme: Emacs\\nau...', false, false, false)\n#4 /home/bbrice/webdev/www-dev/vendor/symfony/yaml/Parser.php(78): Symfony\\Component\\Yaml\\Parser->doParse('synhigh:\\n them...', false, false, false)\n#5 /home/bbrice/webdev/www-dev/vendor/picocms/pico/lib/Pico.php(884): Symfony\\Component\\Ya in /home/bbrice/webdev/www-dev/vendor/symfony/yaml/Parser.php on line 288, referer: http://dev.localhost/parcours/M2pro/
Beside of that and beside of plugin filename, it seems that this plugin is version 2 compatible ! :-)
Forgive me for being so straightforward, but please try to find a solution yourself (especially by reading the docs) before asking such basic questions. It's a simple YAML list.
synhigh:
brush:
- Bash
- Plain
- JScript
- Latex
- Php
- Xml
You are forgiven... I'm sorry, but I'm just a hobbyist coder and it's been a while I touched this code, and I didn't know what to look for exactly. I'm going to open a new thread however regarding another plugin...
So, I made it work and the PicoSyntaxHighlighter is ready (it seems to me) for Pico CMS version 2. The code is here: https://github.com/bricebou/PicoSyntaxHighlighter Again, sorry and many thanks !
Hi again,
I'm planning to upgrade my SyntaxHighlighter plugin (https://github.com/bricebou/pico_SyntaxHighlighter) for Pico 2.
In the old version, the configuration took place in the root
config.php
:I would like to use your new YAML config system but I was wondering where to store the config file (a
synhigh_conf.yml into the root config folder or a config file inside the plugin directory ?) and how to access it (just with
public function onConfigLoaded(array &$config) {}` ?).Thanks in advance !