Skip to content

Instantly share code, notes, and snippets.

@pavel-one
Created May 1, 2018 09:56
Show Gist options
  • Save pavel-one/84cbe6a5548649468b13f18f6fa9a875 to your computer and use it in GitHub Desktop.
Save pavel-one/84cbe6a5548649468b13f18f6fa9a875 to your computer and use it in GitHub Desktop.
Нужные модификаторы для ms2
<?php
/** @var modX $modx */
switch ($modx->event->name) {
case 'pdoToolsOnFenomInit':
$fenom->addModifier('round', function ($input) {
return round($input,1);
});
$fenom->addModifier('format_price', function ($input) {
global $modx;
$miniShop2 = $modx->getService('miniShop2');
return $miniShop2->formatPrice($input);
});
break;
}
@ArviZ
Copy link

ArviZ commented May 26, 2018

а не лучше использовать use ?
$fenom->addModifier('format_price', function ($input) { => $fenom->addModifier('format_price', function ($input) use ($modx) {
=)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment