⇦ Back to Document classMethod addScriptDeclaration
public \Joomla\CMS\Document\Document
addScriptDeclaration
(mixed $content, mixed $type = 'text/javascript')
Adds a script to the page
Parameters
- string $content Script
- string $type Scripting mime (defaults to 'text/javascript')
Returns
- \Joomla\CMS\Document\Document instance of $this to allow chaining
Since
Deprecated
Method addScriptDeclaration - Source code
/**
* Adds a script to the page
*
* @param string $content Script
* @param string $type Scripting mime (defaults to 'text/javascript')
*
* @return Document instance of $this to allow chaining
*
* @since 1.7.0
*
* @deprecated 5.0 Use WebAssetManager
*/
public function addScriptDeclaration($content, $type = 'text/javascript')
{
$type = strtolower($type);
if (empty($this->_script[$type])) {
$this->_script[$type] = array();
}
$this->_script[$type][md5($content)] = $content;
return $this;
}