public function onBeforeQueryConditionalTexts( mixed &$query ) : void

Fires while retrieving the available conditional texts to use for the notification e-mails.


Description 

The system uses the conditional texts to extend the mailing information according to specific conditions.

It is possible to use this hook to manually alter the query used to fetch them from the database.


Parameters

&$query

(mixed)  Either a string or a query builder object.

Return Value

None.


Example

The example below automatically excludes all the unpublished conditional texts. Since the conditional texts don't support a column to check whether they are published or not, it is assumed that such a column is manually added by altering the database table.

/**
 * Trigger hook to allow external plugins to manipulate the query used
 * to load the conditional texts through this helper class.
 *
 * @param   mixed  &$query  A query builder object.
 *
 * @return  void
 */
public function onBeforeQueryConditionalTexts(&$query)
{
    // It is assumed that the database table has been altered accordingly:
    // ALTER TABLE `#__vikrestaurants_mail_text`
    // ADD COLUMN `published` tinyint(1) DEFAULT 1;

    // take only the published conditional texts
    $query->where('m.published = 1');
}

Changelog

Version Description
1.9 Introduced.
Last Update: 2023-12-29 14:15
Helpful?
See Also: