Back to MailTemplate class

Method deleteTemplate

public static bool
deleteTemplate
(mixed $key)
Method to delete a mail template
Parameters
  • string $key The key of the mail template
Returns
  • bool True on success, false on failure
Since
  • 4.0.0
Class: MailTemplate
Project: Joomla

Method deleteTemplate - Source code

/**
 * Method to delete a mail template
 *
 * @param   string  $key  The key of the mail template
 *
 * @return  boolean  True on success, false on failure
 *
 * @since   4.0.0
 */
public static function deleteTemplate($key)
{
    $db = Factory::getDbo();
    $query = $db->getQuery(true);
    $query->delete($db->quoteName('#__mail_templates'))->where($db->quoteName('template_id') . ' = :key')->bind(':key', $key);
    $db->setQuery($query);
    return $db->execute();
}