method setUrl documentation in bbn\Appui\Medias
Adds or replace a URL for a given item's ID
function(string $id_item, string $url, string $type = NULL)
{
$this->checkUrlCfg();
if (!($url = $this->sanitizeUrl($url))) {
throw new Exception(X::_("The URL can't be empty"));
}
if (!($id_url = $this->url->retrieveUrl($url))
&& (!$id_url = $this->url->add($url, $type ?: $this->urlType))
) {
throw new Exception(X::_("Impossible to add the URL %s", $url));
}
if ($checkItem = $this->urlToId($id_url)) {
if ($checkItem !== $id_item) {
throw new Exception(X::_("The URL is already in use by another item"));
}
}
elseif (!$this->db->insert($this->urlTable, [
$this->class_cfg['urlItemField'] => $id_item,
$this->urlFields['id_url'] => $id_url
])) {
return null;
}
return $id_url ?: null;
}
Adds or replace a URL for a given item's ID BBN is a suite of PHP and JS libraries and VueJS components - all open-source! bbn.io, build applications, the quick way
This website uses cookies to ensure you get the best experience on our website.
© 2011-2023
BBN Solutions