Пример #1
0
 /**
  * This is what will be returned when the property is requested in the frontend.
  *
  * You can override this function in order to provide your own output logic.
  *
  * @return mixed
  */
 public function getValue()
 {
     if ($this->i18n) {
         $this->value = I18n::decode($this->value);
     }
     return $this->value;
 }
 /**
  * Update the caption of storage file.
  *
  * @return boolean
  */
 public function actionFilemanagerUpdateCaption()
 {
     $fileId = Yii::$app->request->post('id', false);
     $captionsText = Yii::$app->request->post('captionsText', false);
     if ($fileId && $captionsText) {
         $model = StorageFile::findOne($fileId);
         if ($model) {
             $model->updateAttributes(['caption' => I18n::encode($captionsText)]);
             $this->flushApiCache();
             return true;
         }
     }
     return false;
 }
Пример #3
0
 /**
  *
  * @param array $fieldValues
  * @return string|unknown
  */
 public function i18nDecodedGetActive(array $fieldValues)
 {
     return I18n::findCurrent($fieldValues);
 }
Пример #4
0
 /**
  * Get the array with all captions from the filemanager global "captions" definition for all provided languages
  *
  * @return array Get the array with all captions from the filemanager global "captions" definition for all provided languages
  */
 public function getCaptionArray()
 {
     return I18n::decode($this->itemArray['caption']);
 }