public function metaAccess($params, $smarty)
    {
        $meta = $this->getParam($params, 'meta', null);
        $key = $this->getParam($params, 'key', null);
        $id = $this->getParam($params, 'id', null);

        $cacheKey = sprintf('meta_%s_%s_%s', $meta, $key, $id);

        $out = null;

        if (array_key_exists($cacheKey, self::$dataAccessCache)) {
            return self::$dataAccessCache[$cacheKey];
        }

        if ($key !== null && $id !== null) {
            if ($meta === null) {
                $out = MetaDataQuery::getAllVal($key, (int) $id);
            } else {
                $out = MetaDataQuery::getVal($meta, $key, (int) $id);
            }
        } else {
            throw new \InvalidArgumentException("key and id arguments are required in meta access function");
        }

        self::$dataAccessCache[$cacheKey] = $out;

        if (!empty($params['out'])) {
            $smarty->assign($params['out'], $out);

            return $out !== null ? true : false;
        } else {
            if (is_array($out)) {
                throw new \InvalidArgumentException('The argument "out" is required if the meta value is an array');
            }

            return $out;
        }
    }
public function metaAccess($params, $smarty)
    {
        $meta = $this->getParam($params, 'meta', null);
        $key = $this->getParam($params, 'key', null);
        $id = $this->getParam($params, 'id', null);

        $cacheKey = sprintf('meta_%s_%s_%s', $meta, $key, $id);

        $out = null;

        if (array_key_exists($cacheKey, self::$dataAccessCache)) {
            return self::$dataAccessCache[$cacheKey];
        }

        if ($key !== null && $id !== null) {
            if ($meta === null) {
                $out = MetaDataQuery::getAllVal($key, (int) $id);
            } else {
                $out = MetaDataQuery::getVal($meta, $key, (int) $id);
            }
        } else {
            throw new \InvalidArgumentException("key and id arguments are required in meta access function");
        }

        self::$dataAccessCache[$cacheKey] = $out;

        if (!empty($params['out'])) {
            $smarty->assign($params['out'], $out);

            return $out !== null ? true : false;
        } else {
            if (is_array($out)) {
                throw new \InvalidArgumentException('The argument "out" is required if the meta value is an array');
            }

            return $out;
        }
    }
public function metaAccess ( $ params , $ smarty ) { $ meta = $ this -> getParam ( $ params , 'meta' , null ) ; $ key = $ this -> getParam ( $ params , 'key' , null ) ; $ id = $ this -> getParam ( $ params , 'id' , null ) ; $ cacheKey = sprintf ( 'meta_%s_%s_%s' , $ meta , $ key , $ id ) ; $ out = null ; if ( array_key_exists ( $ cacheKey , self :: $ dataAccessCache ) ) { return self :: $ dataAccessCache [ $ cacheKey ] ; } if ( $ key !== null && $ id !== null ) { if ( $ meta === null ) { $ out = MetaDataQuery :: getAllVal ( $ key , ( int ) $ id ) ; } else { $ out = MetaDataQuery :: getVal ( $ meta , $ key , ( int ) $ id ) ; } } else { throw new \ InvalidArgumentException ( "key and id arguments are required in meta access function" ) ; } self :: $ dataAccessCache [ $ cacheKey ] = $ out ; if ( ! empty ( $ params [ 'out' ] ) ) { $ smarty -> assign ( $ params [ 'out' ] , $ out ) ; return $ out !== null ? true : false ; } else { if ( is_array ( $ out ) ) { throw new \ InvalidArgumentException ( 'The argument "out" is required if the meta value is an array' ) ; } return $ out ; } }
Retrieve meta data associated to an element

params should contain at least key an id attributes. Thus it will return
an array of associated data.

If meta argument is specified then it will return an unique value.

@param array $params
@param \Smarty $smarty

@throws \InvalidArgumentException

@return string|array|null
Retrieve meta data associated to an element