Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

LatteMacros::formatArray is not static

  • Loading branch information...
commit b51d8bd49a040f4876e98da8e42b4b3a0d021807 1 parent 7aa8922
@foowie authored
Showing with 18 additions and 3 deletions.
  1. +18 −3 FormMacros.php
View
21 FormMacros.php
@@ -26,6 +26,9 @@ class FormMacros extends \Nette\Object {
protected static $stack;
+ /** @var LatteMacros */
+ protected static $latteMacros = null;
+
public static $defaultOuterError = "div class='form-errors'";
public static $defaultInnerError = "p class='error'";
@@ -64,7 +67,8 @@ public static function formEnd() {
// <editor-fold defaultstate="collapsed" desc="{formErrors}">
public static function macroFormErrors($content) {
- $params = LatteMacros::formatArray($content);
+ $latteMacros = self::getLatteMacros();
+ $params = $latteMacros->formatArray($content);
return "Addons\Forms\FormMacros::formErrors($params)";
}
public static function formErrors($parameters) { // todo: refactor
@@ -186,6 +190,16 @@ public static function register() {
}
/**
+ * Return instance of LatteMacros
+ * @return LatteMacros
+ */
+ public static function getLatteMacros() {
+ if(self::$latteMacros === null)
+ self::$latteMacros = new LatteMacros();
+ return self::$latteMacros;
+ }
+
+ /**
* Return current rendered form
* @return Form
*/
@@ -224,9 +238,10 @@ protected static function applyModifiers(Html $element, array $modifiers) {
}
protected static function fetchNameAndModifiers($content) {
- $name = LatteMacros::fetchToken($content);
+ $latteMacros = self::getLatteMacros();
+ $name = $latteMacros->fetchToken($content);
$name = String::startsWith($name, '$') ? $name : "'$name'";
- $modifiers = LatteMacros::formatArray($content);
+ $modifiers = $latteMacros->formatArray($content);
$modifiers = $modifiers ?: "array()";
return array($name, $modifiers);
}
Please sign in to comment.
Something went wrong with that request. Please try again.