@@ -92,7 +92,7 @@ |
||
| 92 | 92 | */ |
| 93 | 93 | public function getTranslator() |
| 94 | 94 | { |
| 95 | - if (! $this->isTranslatorEnabled()) { |
|
| 95 | + if (!$this->isTranslatorEnabled()) { |
|
| 96 | 96 | return; |
| 97 | 97 | } |
| 98 | 98 | |
@@ -29,7 +29,7 @@ |
||
| 29 | 29 | * @param \Zend\I18n\Translator\TranslatorInterface $translator |
| 30 | 30 | * @return \UIComponents\Template\TemplateAbstract |
| 31 | 31 | */ |
| 32 | - public function __construct ($tags = false, $translator = null) |
|
| 32 | + public function __construct($tags = false, $translator = null) |
|
| 33 | 33 | { |
| 34 | 34 | return parent::__construct($tags, $translator); |
| 35 | 35 | } |
@@ -30,25 +30,25 @@ discard block |
||
| 30 | 30 | * Needles (static) |
| 31 | 31 | * @var array |
| 32 | 32 | */ |
| 33 | - public $needles = array (); |
|
| 33 | + public $needles = array(); |
|
| 34 | 34 | |
| 35 | 35 | /** |
| 36 | 36 | * Replacements (static) |
| 37 | 37 | * @var array |
| 38 | 38 | */ |
| 39 | - public $replacements = array (); |
|
| 39 | + public $replacements = array(); |
|
| 40 | 40 | |
| 41 | 41 | /** |
| 42 | 42 | * dynamicNeedles (dynamic) |
| 43 | 43 | * @var array |
| 44 | 44 | */ |
| 45 | - public $dynamicNeedles = array (); |
|
| 45 | + public $dynamicNeedles = array(); |
|
| 46 | 46 | |
| 47 | 47 | /** |
| 48 | 48 | * dynamicReplacements (dynamic) |
| 49 | 49 | * @var array |
| 50 | 50 | */ |
| 51 | - public $dynamicReplacements = array (); |
|
| 51 | + public $dynamicReplacements = array(); |
|
| 52 | 52 | |
| 53 | 53 | /** |
| 54 | 54 | * Dynamic counter |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | * Tags array (for dynamic blocks); |
| 61 | 61 | * @var array |
| 62 | 62 | */ |
| 63 | - public $tags = array ( |
|
| 63 | + public $tags = array( |
|
| 64 | 64 | 'static' => '{%s}', |
| 65 | 65 | 'start' => '<!-- BEGIN:BLOCK -->', |
| 66 | 66 | 'end' => '<!-- END:BLOCK -->' |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | * @param \Zend\I18n\Translator\TranslatorInterface $translator |
| 80 | 80 | * @return \UIComponents\Template\TemplateAbstract |
| 81 | 81 | */ |
| 82 | - public function __construct ($tags = false, $translator = null) |
|
| 82 | + public function __construct($tags = false, $translator = null) |
|
| 83 | 83 | { |
| 84 | 84 | if (is_array($tags)) |
| 85 | 85 | { |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | * @param $sDomain string Sets the domain to use for template translations |
| 103 | 103 | * @return self |
| 104 | 104 | */ |
| 105 | - public function setDomain ($sDomain) |
|
| 105 | + public function setDomain($sDomain) |
|
| 106 | 106 | { |
| 107 | 107 | $this->_sDomain = $sDomain; |
| 108 | 108 | return $this; |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | * @param $encoding string Encoding to set |
| 143 | 143 | * @return self |
| 144 | 144 | */ |
| 145 | - public function setEncoding ($encoding) |
|
| 145 | + public function setEncoding($encoding) |
|
| 146 | 146 | { |
| 147 | 147 | $this->_encoding = $encoding; |
| 148 | 148 | return $this; |
@@ -167,10 +167,10 @@ discard block |
||
| 167 | 167 | public function reset() |
| 168 | 168 | { |
| 169 | 169 | $this->dynamicContent = 0; |
| 170 | - $this->needles = array (); |
|
| 171 | - $this->replacements = array (); |
|
| 172 | - $this->dynamicNeedles = array (); |
|
| 173 | - $this->dynamicReplacements = array (); |
|
| 170 | + $this->needles = array(); |
|
| 171 | + $this->replacements = array(); |
|
| 172 | + $this->dynamicNeedles = array(); |
|
| 173 | + $this->dynamicReplacements = array(); |
|
| 174 | 174 | return $this; |
| 175 | 175 | } |
| 176 | 176 | |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | unset ($pieces[0][0]); |
| 216 | 216 | |
| 217 | 217 | //generate dynamic blocks |
| 218 | - for ($a = 0; $a < $this->dynamicContent; $a ++) { |
|
| 218 | + for ($a = 0; $a < $this->dynamicContent; $a++) { |
|
| 219 | 219 | $content .= str_replace($this->dynamicNeedles[$a], $this->dynamicReplacements[$a], $pieces[1][0]); |
| 220 | 220 | } |
| 221 | 221 | unset ($pieces[1][0]); |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | |
| 230 | 230 | if ($this->_encoding != "") |
| 231 | 231 | { |
| 232 | - $content = '<meta http-equiv="Content-Type" content="text/html; charset=' . $this->_encoding . '">' . "\n" . $content; |
|
| 232 | + $content = '<meta http-equiv="Content-Type" content="text/html; charset='.$this->_encoding.'">'."\n".$content; |
|
| 233 | 233 | //$content = str_replace("</head>", '<meta http-equiv="Content-Type" content="text/html; charset='.$this->_encoding.'">'."\n".'</head>', $content); |
| 234 | 234 | } |
| 235 | 235 | |
@@ -252,12 +252,12 @@ discard block |
||
| 252 | 252 | |
| 253 | 253 | // Be sure that php code stays unchanged |
| 254 | 254 | $php_matches = array(); |
| 255 | - $container = array(); |
|
| 255 | + $container = array(); |
|
| 256 | 256 | if (preg_match_all('/<\?(php)?((.)|(\s))*?\?>/i', $template, $php_matches)) { |
| 257 | 257 | $x = 0; |
| 258 | 258 | foreach ($php_matches[0] as $php_match) { |
| 259 | 259 | $x++; |
| 260 | - $template = str_replace ($php_match , "{PHP#".$x."#PHP}", $template); |
|
| 260 | + $template = str_replace($php_match, "{PHP#".$x."#PHP}", $template); |
|
| 261 | 261 | $container[$x] = $php_match; |
| 262 | 262 | } |
| 263 | 263 | } |
@@ -267,14 +267,14 @@ discard block |
||
| 267 | 267 | preg_match_all("/".preg_quote($functionName, "/")."\\(([\\\"\\'])(.*?)\\1\\)/s", $template, $matches); |
| 268 | 268 | |
| 269 | 269 | $matches = array_values(array_unique($matches[2])); |
| 270 | - for ($a = 0; $a < count($matches); $a ++) { |
|
| 270 | + for ($a = 0; $a < count($matches); $a++) { |
|
| 271 | 271 | $template = preg_replace("/".preg_quote($functionName, "/")."\\([\\\"\\']".preg_quote($matches[$a], "/")."[\\\"\\']\\)/s", $this->translate($matches[$a], $this->_sDomain), $template); |
| 272 | 272 | } |
| 273 | 273 | |
| 274 | 274 | // Change back php placeholder |
| 275 | 275 | if (is_array($container)) { |
| 276 | 276 | foreach ($container as $x => $php_match) { |
| 277 | - $template = str_replace ("{PHP#".$x."#PHP}" , $php_match, $template); |
|
| 277 | + $template = str_replace("{PHP#".$x."#PHP}", $php_match, $template); |
|
| 278 | 278 | } |
| 279 | 279 | } |
| 280 | 280 | return $this; |
@@ -32,7 +32,7 @@ |
||
| 32 | 32 | * |
| 33 | 33 | * @var array |
| 34 | 34 | */ |
| 35 | - protected $invokableClasses = [ ]; |
|
| 35 | + protected $invokableClasses = []; |
|
| 36 | 36 | |
| 37 | 37 | /** |
| 38 | 38 | * Validate the plugin |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | * @param string $classnames |
| 45 | 45 | */ |
| 46 | 46 | public function setClassnames($classnames) { |
| 47 | - if ( null !== $classnames ) { |
|
| 47 | + if (null !== $classnames) { |
|
| 48 | 48 | $this->classnames = $classnames; |
| 49 | 49 | } |
| 50 | 50 | return $this; |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | * @param string $classname |
| 57 | 57 | * @return boolean |
| 58 | 58 | */ |
| 59 | - public function hasClass ($classname) { |
|
| 59 | + public function hasClass($classname) { |
|
| 60 | 60 | $classname = trim($classname); |
| 61 | 61 | if (!empty($classname)) { |
| 62 | 62 | $classes = explode(" ", $this->getClassnames()); |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | * |
| 71 | 71 | * @param string $classname |
| 72 | 72 | */ |
| 73 | - public function addClass ($classname) { |
|
| 73 | + public function addClass($classname) { |
|
| 74 | 74 | $classname = trim($classname); |
| 75 | 75 | if (!empty($classname)) { |
| 76 | 76 | $classes = explode(" ", $this->getClassnames()); |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | * |
| 88 | 88 | * @param string $classname |
| 89 | 89 | */ |
| 90 | - public function removeClass ($classname) { |
|
| 90 | + public function removeClass($classname) { |
|
| 91 | 91 | $classname = trim($classname); |
| 92 | 92 | if (!empty($classname) && $this->hasClass($classname)) { |
| 93 | 93 | $classes = explode(" ", $this->getClassnames()); |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | |
| 29 | 29 | protected $block = false; |
| 30 | 30 | |
| 31 | - protected $_sizes = array('default','xs','sm','lg'); |
|
| 31 | + protected $_sizes = array('default', 'xs', 'sm', 'lg'); |
|
| 32 | 32 | protected $_foundations_sizes = array( |
| 33 | 33 | 'xs' => 'tiny', 'xs' => 'small', 'lg' => 'large', 'default' => '', |
| 34 | 34 | ); |
@@ -47,32 +47,32 @@ discard block |
||
| 47 | 47 | |
| 48 | 48 | $this->setHeader('')->setFooter(''); |
| 49 | 49 | |
| 50 | - if ( isset($options["attributes"]) && is_array($options["attributes"]) ) { |
|
| 50 | + if (isset($options["attributes"]) && is_array($options["attributes"])) { |
|
| 51 | 51 | $component->setAttributes($options["attributes"]); |
| 52 | 52 | } |
| 53 | 53 | $component->setAttributes(array_merge_recursive($component->getAttributes(), array( |
| 54 | 54 | 'role' => 'group' |
| 55 | 55 | ))); |
| 56 | 56 | |
| 57 | - if ( isset($options["vertical"]) && !!$options["vertical"] ) { |
|
| 57 | + if (isset($options["vertical"]) && !!$options["vertical"]) { |
|
| 58 | 58 | $component->setClassnames('btn-group-vertical vertical'); |
| 59 | - } else if ( isset($options["justified"]) && !!$options["justified"] ) { |
|
| 59 | + } else if (isset($options["justified"]) && !!$options["justified"]) { |
|
| 60 | 60 | $component->addClass('btn-group-justified'); |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | - if ( isset($options["size"]) && in_array($options["size"], $component->getSizes()) ) { |
|
| 63 | + if (isset($options["size"]) && in_array($options["size"], $component->getSizes())) { |
|
| 64 | 64 | $component->addClass('btn-group-'.$options["size"].' '.strtolower($this->_foundations_sizes["size"])); |
| 65 | 65 | } |
| 66 | - if ( isset($options["block"]) ) { |
|
| 66 | + if (isset($options["block"])) { |
|
| 67 | 67 | $component->setBlock($options["block"]); |
| 68 | 68 | } |
| 69 | 69 | if ($component->getBlock()) $component->addClass('btn-block expanded'); |
| 70 | 70 | |
| 71 | 71 | |
| 72 | 72 | |
| 73 | - if ( isset($options["buttons"]) && !empty($options["buttons"]) ) { |
|
| 73 | + if (isset($options["buttons"]) && !empty($options["buttons"])) { |
|
| 74 | 74 | $component->setContent($options["buttons"]); |
| 75 | - } else if ( isset($options["content"]) && !empty($options["content"]) ) { |
|
| 75 | + } else if (isset($options["content"]) && !empty($options["content"])) { |
|
| 76 | 76 | $component->setContent($options["content"]); |
| 77 | 77 | } |
| 78 | 78 | |
@@ -51,16 +51,16 @@ discard block |
||
| 51 | 51 | */ |
| 52 | 52 | public function __invoke($config = array(), $options = array()) |
| 53 | 53 | { |
| 54 | - if ( is_object($options) && method_exists($options, 'toArray') ) { |
|
| 54 | + if (is_object($options) && method_exists($options, 'toArray')) { |
|
| 55 | 55 | $options = $options->toArray(); |
| 56 | - } else if ( is_object($options) ) { |
|
| 57 | - $options = (array)$options; |
|
| 56 | + } else if (is_object($options)) { |
|
| 57 | + $options = (array) $options; |
|
| 58 | 58 | } |
| 59 | 59 | |
| 60 | - if ( is_object($config) && method_exists($config, 'toArray') ) { |
|
| 60 | + if (is_object($config) && method_exists($config, 'toArray')) { |
|
| 61 | 61 | $config = $config->toArray(); |
| 62 | - } else if ( is_object($options) ) { |
|
| 63 | - $config = (array)$config; |
|
| 62 | + } else if (is_object($options)) { |
|
| 63 | + $config = (array) $config; |
|
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | $this->setOptions($config); |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | $this->setContent($options['children']); |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | - $this->tags = (object)$this->tags; |
|
| 96 | + $this->tags = (object) $this->tags; |
|
| 97 | 97 | |
| 98 | 98 | $component = clone $this; |
| 99 | 99 | return $component; |
@@ -114,11 +114,11 @@ discard block |
||
| 114 | 114 | * @param mixed $aHTMLTableColumns |
| 115 | 115 | * @return self |
| 116 | 116 | */ |
| 117 | - public function buildHeaderCells ($aHTMLTableColumns) { |
|
| 117 | + public function buildHeaderCells($aHTMLTableColumns) { |
|
| 118 | 118 | $sHTMLTableHeader = ""; |
| 119 | 119 | $sHTMLTableColumnGroup = ""; |
| 120 | 120 | $aColumns = array(); |
| 121 | - foreach ((array)$aHTMLTableColumns as $iColumn => $aColumn) { |
|
| 121 | + foreach ((array) $aHTMLTableColumns as $iColumn => $aColumn) { |
|
| 122 | 122 | if ($aColumn["field"]) { |
| 123 | 123 | $aColumns[] = $aColumn["field"]; |
| 124 | 124 | $sHTMLTableHeader .= "<".$this->tags->headcell." class=\"".$aColumn["field"]."\">".$aColumn["title"]."</".$this->tags->headcell.">"; |
@@ -138,10 +138,10 @@ discard block |
||
| 138 | 138 | * @param mixed $aHTMLTableColumns |
| 139 | 139 | * @return self |
| 140 | 140 | */ |
| 141 | - public function buildFooterCells ($aHTMLTableColumns) { |
|
| 141 | + public function buildFooterCells($aHTMLTableColumns) { |
|
| 142 | 142 | $sHTMLTableFooter = ""; |
| 143 | 143 | $aColumns = array(); |
| 144 | - foreach ((array)$aHTMLTableColumns as $iColumn => $aColumn) { |
|
| 144 | + foreach ((array) $aHTMLTableColumns as $iColumn => $aColumn) { |
|
| 145 | 145 | if ($aColumn["field"]) { |
| 146 | 146 | $aColumns[] = $aColumn["field"]; |
| 147 | 147 | $sHTMLTableFooter .= "<".$this->tags->cell." class=\"".$aColumn["field"]."\">".$aColumn["title"]."</".$this->tags->cell.">"; |
@@ -159,16 +159,16 @@ discard block |
||
| 159 | 159 | * @param mixed $aHTMLTableColumns |
| 160 | 160 | * @return array |
| 161 | 161 | */ |
| 162 | - public function buildBodyCells ($aRowData, $aHTMLTableColumns) { |
|
| 162 | + public function buildBodyCells($aRowData, $aHTMLTableColumns) { |
|
| 163 | 163 | $aRows = array(); |
| 164 | - foreach ( (array)$aRowData as $iRow => $oRowData ) { |
|
| 164 | + foreach ((array) $aRowData as $iRow => $oRowData) { |
|
| 165 | 165 | $sCells = ""; |
| 166 | - foreach ((array)$aHTMLTableColumns as $iColumn => $aColumn) { |
|
| 166 | + foreach ((array) $aHTMLTableColumns as $iColumn => $aColumn) { |
|
| 167 | 167 | $mCellValue = $oRowData[$aColumn["field"]]; |
| 168 | 168 | if (!empty($aColumn["callback"]) && function_exists($aColumn["callback"])) { |
| 169 | 169 | $mCellValue = call_user_func($aColumn["callback"], $oRowData, $aColumn, $iColumn, $iRow); |
| 170 | 170 | } |
| 171 | - if ( isset($aColumn["field"]) && isset($oRowData[$aColumn["field"]]) ) { |
|
| 171 | + if (isset($aColumn["field"]) && isset($oRowData[$aColumn["field"]])) { |
|
| 172 | 172 | $sClassname = $aColumn["field"]; |
| 173 | 173 | } else { |
| 174 | 174 | $sClassname = "col_".$iColumn; |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | * generate mini table mark-up template |
| 199 | 199 | * @return string |
| 200 | 200 | */ |
| 201 | - public function buildMarkupTemplate () { |
|
| 201 | + public function buildMarkupTemplate() { |
|
| 202 | 202 | $aHTML = array( |
| 203 | 203 | "<".$this->tags->container.">", |
| 204 | 204 | "<".$this->tags->row.">", |
@@ -222,25 +222,25 @@ discard block |
||
| 222 | 222 | * generate table mark-up |
| 223 | 223 | * @return string |
| 224 | 224 | */ |
| 225 | - public function buildMarkup () { |
|
| 225 | + public function buildMarkup() { |
|
| 226 | 226 | $sHTML = ""; |
| 227 | 227 | |
| 228 | 228 | $sTableID = $this->getOptions("formID"); |
| 229 | 229 | if (!$sTableID) { |
| 230 | - $sTableID = "table" . md5(microtime()); |
|
| 230 | + $sTableID = "table".md5(microtime()); |
|
| 231 | 231 | $this->options["formID"] = $sTableID; |
| 232 | 232 | } |
| 233 | 233 | |
| 234 | 234 | $this->getTemplate()->reset(); |
| 235 | - $this->getTemplate()->set('s', 'TABLEID', $sTableID ); |
|
| 236 | - $this->buildHeaderCells( $this->getOptions("columns") ); |
|
| 237 | - $this->buildFooterCells( $this->getOptions("footer") ); |
|
| 238 | - $this->buildBodyCells( $this->getData(), $this->getOptions("columns") ); |
|
| 235 | + $this->getTemplate()->set('s', 'TABLEID', $sTableID); |
|
| 236 | + $this->buildHeaderCells($this->getOptions("columns")); |
|
| 237 | + $this->buildFooterCells($this->getOptions("footer")); |
|
| 238 | + $this->buildBodyCells($this->getData(), $this->getOptions("columns")); |
|
| 239 | 239 | $sTemplate = $this->getOptions("template"); |
| 240 | 240 | if ($sTemplate == "") { |
| 241 | 241 | $sTemplate = $this->buildMarkupTemplate(); |
| 242 | 242 | } |
| 243 | - $sHTML = $this->getTemplate()->generate( $sTemplate, true ); |
|
| 243 | + $sHTML = $this->getTemplate()->generate($sTemplate, true); |
|
| 244 | 244 | return $sHTML; |
| 245 | 245 | } |
| 246 | 246 | |
@@ -248,7 +248,7 @@ discard block |
||
| 248 | 248 | * generate table JSON data |
| 249 | 249 | * @return string |
| 250 | 250 | */ |
| 251 | - public function buildData () { |
|
| 251 | + public function buildData() { |
|
| 252 | 252 | $sJSON = "[]"; |
| 253 | 253 | if (!empty($this->data)) { |
| 254 | 254 | $sJSON = json_encode($this->data); |
@@ -272,7 +272,7 @@ discard block |
||
| 272 | 272 | * @param Template $template |
| 273 | 273 | * @return ProductTable |
| 274 | 274 | */ |
| 275 | - public function setTemplate( $template = null ) { |
|
| 275 | + public function setTemplate($template = null) { |
|
| 276 | 276 | if ($template == null) { |
| 277 | 277 | $this->template = new Template; |
| 278 | 278 | } else { |
@@ -294,8 +294,8 @@ discard block |
||
| 294 | 294 | * @param mixed $data |
| 295 | 295 | * @return ProductTable |
| 296 | 296 | */ |
| 297 | - public function setData( $data = null) { |
|
| 298 | - if ( is_array($data) ) { |
|
| 297 | + public function setData($data = null) { |
|
| 298 | + if (is_array($data)) { |
|
| 299 | 299 | $this->data = $data; |
| 300 | 300 | } |
| 301 | 301 | return $this; |
@@ -306,9 +306,9 @@ discard block |
||
| 306 | 306 | * @param string $key |
| 307 | 307 | * @return mixed |
| 308 | 308 | */ |
| 309 | - public function getOptions( $key = "" ) { |
|
| 310 | - if ( !empty($key) ) { |
|
| 311 | - if ( isset($this->options[$key]) ) { |
|
| 309 | + public function getOptions($key = "") { |
|
| 310 | + if (!empty($key)) { |
|
| 311 | + if (isset($this->options[$key])) { |
|
| 312 | 312 | return $this->options[$key]; |
| 313 | 313 | } else { |
| 314 | 314 | return false; |
@@ -322,16 +322,16 @@ discard block |
||
| 322 | 322 | * @return ProductTable |
| 323 | 323 | */ |
| 324 | 324 | public function setOptions($options) { |
| 325 | - if ( is_array($options) ) { |
|
| 325 | + if (is_array($options)) { |
|
| 326 | 326 | $this->options = $options; |
| 327 | - } else if ( is_object($options) ) { |
|
| 328 | - $this->options = (array)$options; |
|
| 327 | + } else if (is_object($options)) { |
|
| 328 | + $this->options = (array) $options; |
|
| 329 | 329 | } else { |
| 330 | 330 | throw new \Exception("invalid table options"); |
| 331 | 331 | } |
| 332 | - if ( isset($this->options["data"]) ) { |
|
| 332 | + if (isset($this->options["data"])) { |
|
| 333 | 333 | $this->setData($this->getOptions("data")); |
| 334 | - unset( $this->options->data ); |
|
| 334 | + unset($this->options->data); |
|
| 335 | 335 | } |
| 336 | 336 | return $this; |
| 337 | 337 | } |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | * @return string the assemled component rendered to HTML |
| 50 | 50 | */ |
| 51 | 51 | public function buildComponent() { |
| 52 | - if ( empty($this->getTagname()) ) { |
|
| 52 | + if (empty($this->getTagname())) { |
|
| 53 | 53 | $this->setTagname('div'); |
| 54 | 54 | // return ''; |
| 55 | 55 | } |
@@ -70,11 +70,11 @@ discard block |
||
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | $content = (array($header, $body, $footer)); |
| 73 | - if ( is_array($body) && !isset($body["tagname"])) { |
|
| 73 | + if (is_array($body) && !isset($body["tagname"])) { |
|
| 74 | 74 | $content = array_merge(array($header), ($body), array($footer)); |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | - $component = $this->_createElement($this->getTagname(), $this->getClassnames(), (array)$this->getAttributes(), $content); |
|
| 77 | + $component = $this->_createElement($this->getTagname(), $this->getClassnames(), (array) $this->getAttributes(), $content); |
|
| 78 | 78 | |
| 79 | 79 | return $component; |
| 80 | 80 | |
@@ -39,38 +39,38 @@ |
||
| 39 | 39 | public function __invoke($formoptions = array(), $field = null) { |
| 40 | 40 | parent::__invoke(array()); |
| 41 | 41 | $form = null; |
| 42 | - if ( !is_array($formoptions) && ($formoptions instanceof \Zend\Form\Form) && (func_num_args() == 2) ) { |
|
| 42 | + if (!is_array($formoptions) && ($formoptions instanceof \Zend\Form\Form) && (func_num_args() == 2)) { |
|
| 43 | 43 | $form = $formoptions; |
| 44 | 44 | $field = func_get_arg(1); |
| 45 | - } else if ( isset($formoptions["form"]) && isset($formoptions["field"]) && ($formoptions["form"] instanceof \Zend\Form\Form) ) { |
|
| 45 | + } else if (isset($formoptions["form"]) && isset($formoptions["field"]) && ($formoptions["form"] instanceof \Zend\Form\Form)) { |
|
| 46 | 46 | $form = $formoptions["form"]; |
| 47 | 47 | $field = $formoptions["field"]; |
| 48 | 48 | } else |
| 49 | - if ( !($form instanceof \Zend\Form\Form) || empty($field) ) { |
|
| 49 | + if (!($form instanceof \Zend\Form\Form) || empty($field)) { |
|
| 50 | 50 | return ""; |
| 51 | 51 | } |
| 52 | 52 | $this->setForm($form); |
| 53 | 53 | |
| 54 | - if ( is_string($field) ) { |
|
| 54 | + if (is_string($field)) { |
|
| 55 | 55 | $field = $form->get($field); |
| 56 | 56 | if (!$field) { |
| 57 | 57 | return ""; |
| 58 | 58 | } |
| 59 | - } else if ( !($field instanceof \Zend\Form\Element) ) { |
|
| 59 | + } else if (!($field instanceof \Zend\Form\Element)) { |
|
| 60 | 60 | return ""; |
| 61 | 61 | } |
| 62 | - if ( !empty($this->getView()->formElementErrors($field)) ) { |
|
| 62 | + if (!empty($this->getView()->formElementErrors($field))) { |
|
| 63 | 63 | $this->addClass('has-error'); |
| 64 | 64 | } |
| 65 | - $this->setHeader( $this->getView()->formLabel($field) ); |
|
| 65 | + $this->setHeader($this->getView()->formLabel($field)); |
|
| 66 | 66 | /** @var \Zend\Form\View\HelperConfig $formPlugins */ |
| 67 | 67 | $formPlugins = $this->getView(); |
| 68 | - if ( $field->getAttribute('type') == 'select' ) { |
|
| 69 | - $this->setContent( $formPlugins->formSelect($field->setAttributes(array('class' => 'form-control'))) ); |
|
| 68 | + if ($field->getAttribute('type') == 'select') { |
|
| 69 | + $this->setContent($formPlugins->formSelect($field->setAttributes(array('class' => 'form-control')))); |
|
| 70 | 70 | } else { |
| 71 | - $this->setContent( $formPlugins->formInput($field->setAttributes(array('class' => 'form-control'))) ); |
|
| 71 | + $this->setContent($formPlugins->formInput($field->setAttributes(array('class' => 'form-control')))); |
|
| 72 | 72 | } |
| 73 | - $this->setFooter( $formPlugins->formElementErrors($field) ); |
|
| 73 | + $this->setFooter($formPlugins->formElementErrors($field)); |
|
| 74 | 74 | |
| 75 | 75 | $component = clone $this; |
| 76 | 76 | return $component; |