terminal42 / contao-pageimage

MIT License
12 stars 14 forks source link

replaceTags not working #20

Closed SeregPie closed 9 years ago

SeregPie commented 9 years ago

I have Contao 3.2.14 installed.

I needed to rewrite the whole function replaceTags to make insert tags work.

public static function replaceTags($strTag) 
{ 
    $arrTag = trimsplit('::', $strTag); 
    $strKey; 
    switch($arrTag[0]) 
    { 
        case 'pageimage': 
        case 'pageimage_src': 
            $strKey = 'path'; 
            break; 
        case 'pageimage_alt': 
            $strKey = 'name'; 
            break; 
        case 'pageimage_title': 
            $strKey = 'name'; 
            break; 
        case 'pageimage_href': 
            $strKey = 'path'; 
            break; 
        default: 
            return false; 
    } 

    global $objPage; 
    $arrImage = static::getOne($objPage, (int) $arrTag[1]); 
    if (null === $arrImage || !isset($arrImage[$strKey])) { 
        return ''; 
    } 
    return $arrImage[$strKey]; 
} 
aschempp commented 9 years ago

See #18

aschempp commented 9 years ago

No, but feel free to make a pull request for fixes ;-)