Exemplo n.º 1
0
 /**
  * Render only one value of the field.
  *
  * @access   protected
  * @param    array   $aFieldValueContent
  * @param    string  $sLang
  * @param    integer $i
  * @return   boolean
  * @since    1.0.0-alpha
  * @version  1.0.0-alpha
  */
 protected function renderSingleValue(array &$aFieldValueContent, $sLang, $i)
 {
     // render file
     if (empty($this->sBrokerModel)) {
         $aFieldValueContent[$i] = View::factory('base/alert')->set('sType', 'warning')->set('sMsg', __('To make this field work properly, there must be a broker model name set.'))->render();
     } else {
         $aFieldValueContent[$i] = View::factory($this->getView())->bind('sLang', $sLang)->bind('iValueNumber', $i)->bind('oField', $this)->set('oCurrentFile', Arrays::path($this->aFile, $sLang . '.' . $i, NULL))->set('oTmpFile', Arrays::path($this->aFileTemp, $sLang . '.' . $i, NULL))->render();
     }
     // return TRUE value to tell, that field rendered successfully
     return TRUE;
 }
Exemplo n.º 2
0
 /**
  * Method is called by Form object when this particular form is used (sent).
  *
  * @access   protected
  * @return   void
  * @since    1.0.0-alpha
  * @version  1.0.0-alpha
  */
 protected function whenFormSubmitted()
 {
     $this->aFormMethodValues = $this->getFormObject()->getMethodValue();
     if ($this->getFormObject()->isFieldsNameWithPrefix()) {
         $mSentData = Helper\Arrays::path($this->aFormMethodValues, $this->getFormObject()->getName() . '.' . $this->getName(), FALSE);
     } else {
         $mSentData = Helper\Arrays::get($this->aFormMethodValues, $this->getName(), FALSE);
     }
     if ($mSentData === FALSE) {
         foreach ($this->getLangs() as $lang) {
             $this->setValue([], 0, $lang);
         }
     }
 }
Exemplo n.º 3
0
 /**
  * Reset form values.
  *
  * @access   protected
  * @return   $this
  * @since    1.0.0-alpha
  * @version  1.0.0-alpha
  */
 protected function resetValue()
 {
     $aDefaultValue = $this->getFormObject()->getDefaultVal($this->getName());
     $this->aFormMethodValues = $this->getFormObject()->getMethodValue();
     foreach ($this->getLangs() as $sLang) {
         if (isset($aDefaultValue[$sLang])) {
             $aDefaultValue[$sLang] = [$aDefaultValue[$sLang]];
         }
     }
     if ($this->getFormObject()->isFieldsNameWithPrefix()) {
         $mSentData = Helper\Arrays::path($this->aFormMethodValues, $this->getFormObject()->getName() . '.' . $this->getName(), FALSE);
     } else {
         $mSentData = Helper\Arrays::get($this->aFormMethodValues, $this->getName(), FALSE);
     }
     if ($mSentData === FALSE && $this->getFormObject()->isSubmitted()) {
         $mSentData = [];
         foreach ($this->getLangs() as $sLang) {
             $mSentData[$sLang][] = [];
         }
     }
     $this->setValue($mSentData !== FALSE ? $mSentData : $aDefaultValue);
     return $this;
 }
Exemplo n.º 4
0
 /**
  * Get field value.
  *
  * @author     Krzysztof Trzos
  * @access     public
  * @param      string  $lang
  * @param      integer $valueNumber
  * @return     mixed
  * @since      1.0.0-alpha
  * @version    1.0.0-alpha
  */
 public function getValue($lang = NULL, $valueNumber = NULL)
 {
     if ($lang === NULL && $valueNumber === NULL) {
         return $this->values;
     } elseif ($lang !== NULL && $valueNumber === NULL) {
         return Helper\Arrays::get($this->values, $lang, []);
     } else {
         return Helper\Arrays::path($this->values, $lang . '.' . $valueNumber);
     }
 }
Exemplo n.º 5
0
 /**
  * Get single metatag content.
  *
  * @access   public
  * @param    string $key
  * @return   string
  * @since    1.0.0-alpha
  * @version  1.0.0-alpha
  */
 public function getMetaTagContent($key)
 {
     return ArraysHelper::path($this->aMeta, $key . '.content');
 }
Exemplo n.º 6
0
 /**
  * Get errors for particular field.
  *
  * @access   public
  * @param    string $sPath
  * @return   array
  * @since    1.0.0-alpha
  * @version  1.0.0-alpha
  */
 public function getErrorsForField($sPath)
 {
     return Helper\Arrays::path($this->fieldsErrors, $sPath, []);
 }
Exemplo n.º 7
0
 /**
  * Get a value from array list
  *
  * @static
  * @access   public
  * @param    string $sWholePath Config name in format [module.]fileName.array.nextArray.value(...)
  * @param    mixed  $mDefault
  * @param    bool   $bForcePath
  * @return   mixed
  * @throws   Exception
  * @since    1.0.0-alpha
  * @version  1.0.0-alpha
  */
 public static function get($sWholePath, $mDefault = NULL, $bForcePath = FALSE)
 {
     if (!in_array($sWholePath, static::$aLoadedConfigs)) {
         static::$aLoadedConfigs[] = $sWholePath;
         $sPathToConfig = $bForcePath ? $sWholePath : static::modifyConfigPathToFilePath($sWholePath);
         static::load($sPathToConfig);
     }
     return Helper\Arrays::path(static::$aConfigs, $sWholePath, $mDefault);
 }