Ejemplo n.º 1
0
 /**
  * Generate list of fields using filed name
  *
  * @param string $fieldName
  * @return array
  * @throws \Exception
  */
 protected function simpleGenerateLocalizationField($fieldName = "")
 {
     if (!is_string($fieldName)) {
         throw new \Exception("Argument is not a string");
     }
     $fields = array();
     if ($this->localization === null) {
         $localizationHelper = new LocalizationHelper();
         $possibleLocalizations = $localizationHelper->getPossibleLocalizations();
         if ($possibleLocalizations === false) {
             throw new \Exception("Cannot get possible localizations");
         }
         if (!empty($possibleLocalizations)) {
             foreach ($possibleLocalizations as $prefix) {
                 $fields[] = $fieldName . "_" . $prefix;
             }
         }
     } else {
         $fields[] = $fieldName . "_" . $this->localization . "(" . $fieldName . ")";
     }
     return $fields;
 }