getArticle

The getArticle allows you to override the configuration of an article prior to rendering. It does not expect a return value.

Parameters

  1. Database_Result $objRow

    The database result from table tl_article.

Example

<?php

// config.php
$GLOBALS['TL_HOOKS']['getArticle'][] = array('MyClass', 'myGetArticle');

// MyClass.php
public function myGetArticle(Database_Result $objRow)
{
    // Add CSS class based on a custom field
    if ($objRow->grid == '4')
    {
        $arrCSS = deserialize($objRow->cssID, true);
        // use trim() to remove the leading space if $arrCSS[1] is empty
        $arrCSS[1] = trim($arrCSS[1] . ' grid4');
        $objRow->cssID = serialize($arrCSS);
    }
}

More information

References

See also

  • getFrontendModule – triggered when a front end module is generated.
  • getContentElement – triggered when a content element is generated.
  • getForm – triggered when a form is generated.
  • isVisibleElement – triggered when checking if an element should be visible in the front end or not.

results matching ""

    No results matching ""