示例#1
0
 public function extraVars()
 {
     $linkIsExternal = true;
     $link = $this->getCfgValue('externalLink', false);
     if (!$link && $this->getCfgValue('internalLink', false)) {
         $linkIsExternal = false;
         $link = Yii::$app->menu->find()->where(['nav_id' => $this->getCfgValue('internalLink')])->one();
         if ($link) {
             $link = $link->link;
         } else {
             $link = false;
         }
     }
     return ['image' => BlockHelper::imageUpload($this->getVarValue('imageId')), 'imageAdmin' => BlockHelper::imageUpload($this->getVarValue('imageId', 'medium-thumbnail')), 'text' => $this->getText(), 'link' => $link, 'linkIsExternal' => $linkIsExternal];
 }
 /**
  * Return an array containg all extra vars. Those variables you can access in the Twig Templates via {{extras.*}}.
  */
 public function extraVars()
 {
     return ['link' => $this->getLinkTarget(), 'file' => $this->getFileUrl(), 'imageId' => BlockHelper::imageUpload($this->getVarValue('imageId')), 'text' => $this->getText(), 'thumbnail' => BlockHelper::imageUpload($this->getVarValue('imageId'), 'small-thumbnail')];
 }
 public function extraVars()
 {
     return ['imageSource' => $this->getImageSource(), 'imageAdmin' => BlockHelper::imageUpload($this->getVarValue('imageId'), 'medium-thumbnail'), 'imagePosition' => $this->getVarValue('imagePosition', 'left'), 'imageWidth' => $this->getImageSource() ? @getimagesize($this->getImageSource())[0] : 0, 'margin' => $this->getCfgValue('margin', $this->defaultMargin), 'text' => $this->getText()];
 }
 /**
  * Get all informations from an zaa-image-upload type:
  *
  * ```php
  * 'image' => $this->zaaImageUpload($this->getVarValue('myImage')),
  * ```
  *
  * apply a filter for the image
  *
  * ```php
  * 'imageFiltered' => $this->zaaImageUpload($this->getVarValue('myImage'), 'small-thumbnail'),
  * ```
  *
  * @deprecated Will be removed in 1.0.0
  * @param string|int $value Provided the value
  * @param boolean|string $applyFilter To apply a filter insert the identifier of the filter.
  * @param boolean $returnObject Whether the storage object should be returned or an array.
  * @return boolean|array Returns false when not found, returns an array with all data for the image on success.
  */
 protected function zaaImageUpload($value, $applyFilter = false, $returnObject = false)
 {
     trigger_error('Deprecated method ' . __METHOD__ . ' in ' . get_called_class() . ', use \\luya\\cms\\helpers\\BlockHelper::imageUpload() instead.', E_USER_DEPRECATED);
     return BlockHelper::imageUpload($value, $applyFilter, $returnObject);
 }