public function configSiteVariables(MvcEvent $event) { // Fetch configuration $config = $event->getApplication()->getServiceManager()->get("Config"); $options = array_key_exists('application_settings', $config) ? $config['application_settings'] : []; $variables = new ModuleOptions($options); // Set configuration $event->getViewModel()->setVariables($variables->toArray()); }
/** * Render an element * * @param ElementInterface $oElement * @return string */ public function render(ElementInterface $oElement) { // Add form-controll class $sElementType = $oElement->getAttribute('type'); if (!in_array($sElementType, $this->options->getIgnoredViewHelpers()) && !$oElement instanceof Collection) { $sElementClass = $oElement->getAttribute('class'); if ($sElementClass) { if (!preg_match('/(\\s|^)form-control(\\s|$)/', $sElementClass)) { $oElement->setAttribute('class', trim($sElementClass . ' form-control')); } } else { $oElement->setAttribute('class', 'form-control'); } } $sMarkup = parent::render($oElement); // Addon prepend $aAddOnPrepend = $oElement->getOption('add-on-prepend'); if ($aAddOnPrepend) { $sMarkup = $this->renderAddOn($aAddOnPrepend) . $sMarkup; } // Addon append $aAddOnAppend = $oElement->getOption('add-on-append'); if ($aAddOnAppend) { $sMarkup .= $this->renderAddOn($aAddOnAppend); } if ($aAddOnAppend || $aAddOnPrepend) { $sSpecialClass = ''; // Input size $sElementClass = $oElement->getAttribute('class'); if ($sElementClass) { if (preg_match('/(\\s|^)input-lg(\\s|$)/', $sElementClass)) { $sSpecialClass .= ' input-group-lg'; } elseif (preg_match('/(\\s|^)input-sm(\\s|$)/', $sElementClass)) { $sSpecialClass .= ' input-group-sm'; } } return sprintf(self::$inputGroupFormat, trim($sSpecialClass), $sMarkup); } return $sMarkup; }