Collections functions
General functions
Render functions
Theme permission functions
User functions
Resource functions



Generates a HTML link for adding a resource to a collection

IMPORTANT: never use untrusted data here!


$resource integer ID of resource
$extracode string "" Additional code to be run when link is selected
$size string "" Resource size if appropriate
$class string "" Class to be applied to link
$view_title string "": string { # Generates a HTML link for removing a resource from a collection # The collection is referred to as the basket when in basket mode global $lang The title of the field, taken from $view_title_field
jQuery'div#ResourceShell{$resource}'} {draggable:
{$extracode} '{$size}'; \"{$resource}\"" . generate_csrf_data_for_api_native_authmode'add_resource_to_collection' . ">"; } /** * Render a "remove from collection" link wherever such a function is shown in the UI * * @param integer $resource * @param string $class * @param string $onclick Additional onclick code to call before returning false. * @param bool $basketmode Whether removing from a basket or a collection. * @param string $view_title The title of the field
from taken
$onclick string ''
$basketmode false
{$onclick} '{$pagename}'; \"{$resource}\"" . generate_csrf_data_for_api_native_authmode'remove_resource_from_collection' . ">"; } /** * Generates a HTML link for adding a changing the current collection * * @param integer $collection * @return string */ function change_collection_link$collection




include/collections_functions.php lines 3472 to 3484


function add_to_collection_link($resource$extracode=""$size=""$class=""$view_title=""): string
$resource = (int) $resource;
$size escape_quoted_data($size);
$class escape_quoted_data($class);
$title escape_quoted_data($GLOBALS['lang']["addtocurrentcollection"] . " - " $view_title);

"<a class=\"addToCollection {$class}\" href=\"#\" title=\"{$title}\""
" onClick=\"AddResourceToCollection(event, {draggable: jQuery('div#ResourceShell{$resource}')},'{$resource}','{$size}'); {$extracode} return false;\""
" data-resource-ref=\"{$resource}\""

This article was last updated 7th December 2023 19:05 Europe/London time based on the source file dated 21st November 2023 15:25 Europe/London time.