render_functions.php
Functions used to render HTML & Javascript
Table of Contents
Enums
Functions
- render_search_field() : mixed
- Renders the HTML for the provided $field for inclusion in a search form, for example the advanced search page. Standard field titles are translated using $lang. Custom field titles are i18n translated.
- render_sort_order() : mixed
- Renders sort order functionality as a dropdown box
- render_dropdown_option() : mixed
- Renders a dropdown option
- render_actions() : void
- Renders search actions functionality as a dropdown box
- render_user_group_multi_select() : mixed
- render_user_group_checkbox_select() : void
- Renders a list of user groups
- render_text_question() : void
- render_text_input_question - Used to display a question with simple text input
- render_split_text_question() : mixed
- render_split_text_question - Used to display a question with two inputs e.g. for a from/to range
- render_dropdown_question() : void
- render_dropdown_question - Used to display a question with a dropdown selector
- render_access_key_tr() : void
- Render a table row (tr) for a single access key
- is_field_displayed() : bool
- Checks whether a specified field should be displayed based on various conditions.
- display_field() : mixed
- Displays a field in the resource edit interface.
- render_date_range_field() : mixed
- Renders a date range input field for resource editing.
- renderBreadcrumbs() : void
- Renders a full breadcrumbs trail.
- render_new_featured_collection_cta() : void
- Render a blank tile used for call to actions (e.g: on featured collections, a tile for creating new collections)
- renderSocialMediaShareLinksForUrl() : void
- Renders social media links in order to share a particular link
- renderLockButton() : void
- Renders a lock button for a field - used to 'lock' metadata in upload_review_mode
- render_resource_image() : void
- Renders an image, with width and height specified for centering in div
- calculate_image_display() : array<string|int, mixed>
- Calculations width, height and margin-top property for resource image to display in ResourcePanel
- render_share_options() : void
- Render the share options (used on collection_share.php and resource_share.php)
- render_field_selector_question() : void
- Renders a metadata field selector
- render_filter_bar_button() : void
- Render a filter bar button
- render_upload_here_button() : void|array<string|int, mixed>
- Render "Upload here" button.
- render_trash() : string|void
- Renders the trash bin. This is used to delete dash tiles and remove resources from collections
- render_help_link() : mixed
- Generates a help icon that opens the relevant Knowledge Base article in a modal
- render_question_div() : void
- Render generic Question div (including clearleft)
- render_custom_fields() : true
- Render custom fields (NOT metadata fields)
- render_selected_resources_counter() : string
- Generates HTML for the "X Selected" in the search results found part pointing to the special collection COLLECTION_TYPE_SELECTION
- render_edit_selected_btn() : void
- Renders the "Edit selected" button. This is using the special 'COLLECTION_TYPE_SELECTION' collection
- render_clear_selected_btn() : void
- Renders the "Clear selected" button. This is using the special 'COLLECTION_TYPE_SELECTION' collection
- render_selected_collection_actions() : void
- Render the actions specific to when a user selected resources (using the special "COLLECTION_TYPE_SELECTION" collection)
- render_user_collection_select() : mixed
- render_csrf_data_attributes() : mixed
- Render CSRF information as data attributes. Useful to allow JS to run state changing operations
- check_display_condition() : bool
- Check display condition for a field.
- display_upload_options() : bool
- Utility to if collapsable upload options should be displayed
- display_field_data() : mixed
- render_fixed_list_as_pills() : string
- render_resource_lock_link() : mixed
- EditNav() : void
- EditNav - render html for next/back browsing on the resource edit page. Called by SaveAndClearButtons()
- SaveAndClearButtons() : void
- Render the 'QuestionSubmit' div with the 'Save', 'Clear' and 'Save all with values' locked Buttons - used by the resource edit page
- display_size_option() : void
- display_size_option
- render_featured_collection_category_selector() : void
- Render the featured collection category selector
- render_featured_collections() : mixed
- Render featured collections (as tiles on the collections_featured.php page)
- render_featured_collection() : void
- Render a featured collection (as tiles on the collections_featured.php page)
- render_top_right_menu_btn() : void
- Render the top right menu button ellipsis icon.
- render_featured_collection_context_menu() : void
- Render a featured collection (category) contextual menu
- DrawOption() : void
- Renders an option in the Permission Manager (admin_group_permissions.php page)
- render_featured_collections_category_permissions() : void
- Render featured collections options in the Permission Manager (admin_group_permissions.php page)
- show_upgrade_in_progress() : void
- show_upgrade_in_progress message
- render_audio_download_link() : mixed
- add link to mp3 preview file if resource is a wav file
- render_table() : void
- Render a table based on ResourceSpace data to include sorting by various columns
- render_array_in_table_cells() : void
- Render multimensional array or object to display within table cells
- render_top_page_error_style() : void
- Render the top page error style version
- render_question_form_helper() : mixed
- Render a FormHelper. These are used in forms, to provide extra information to the user to a question.
- render_hidden_input() : mixed
- Render an HTML hidden input
- render_workflow_state_question() : mixed
- Renders a dropdown for selecting the workflow state of a resource.
- render_share_password_question() : mixed
- Renders a question field for setting a share password.
- radio_get_layout() : array<string|int, mixed>
- Get required rows and columns for use when displaying radio buttons in a table
- render_radio_buttons_question() : void
- render_radio_buttons_question - Used to display a question with radio buttons
- render_message() : void
- Render a user message for use in conversation view
- render_antispam_question() : mixed
- Render the antispam Question form section
- render_fixed_text_question() : void
- Renders a 'fixed' text question - not an input but to display information or values that cannot be changed
- escape() : string
- Output encoding for HTML context when unsafe input is rendered inside it
- encode_js_value() : string
- Output encoding for Javascript (JS) context. Allows PHP code to embed data as a JS value by producing a JS-compatible literal for the common JSON types.
- html_break_long_words() : string
- HTML aware function to break up long words onto multiple lines for PDF generation where CSS text wrapping can't be used
- render_lucide_icon_selector() : void
- Renders a Lucide icon selector question Requires lib/lucide/icon_classes.php to be included in the page using the function
- display_related_resources() : void
- Render all related resources on view page
- admin_resource_type_field_constraint() : void
- Display appropriate field constraint for use on admin_resource_type_field_edit.php e.g. single select/Number
- admin_resource_type_field_option() : void
- Render metadata field option input on admin_resource_type_field_edit.php
- render_resource_type_selector_question() : void
- Renders a resource type selection dropdown
- add_download_column() : mixed
- Render the Download info for the resource tool (on view page)
- render_resource_view_image() : void
- Render image on view.php
- render_resource_tools_size_download_options() : void
- Render the resource tools for preview sizes
- toast_notification() : void
- Adds script to display toast notification. Note: Must be included after header.php.
- render_icon_wrapper_component() : void
- render_header_links() : void
- Render the header's primary navigation. In responsive mode, all the nav links are being overflown.
- get_smart_fc_branch_trail() : array<string|int, mixed>
- Helper function for smart featured collections to update $branch_trail with all parent nodes of the selected node
Functions
render_search_field()
Renders the HTML for the provided $field for inclusion in a search form, for example the advanced search page. Standard field titles are translated using $lang. Custom field titles are i18n translated.
render_search_field(mixed $field, mixed $fields[, mixed $value = "" ][, mixed $autoupdate = false ][, mixed $class = "stdwidth" ][, mixed $forsearchbar = false ][, mixed $limit_keywords = array() ][, array<string|int, mixed> $searched_nodes = array() ][, mixed $reset = "" ][, mixed $simpleSearchFieldsAreHidden = false ]) : mixed
$field the field being rendered as an associative array of field data, i.e. one row from the resource_type_field table. $fields the array of fields data, i.e. multiple rows from the resource_type_field table. $name the input name to use in the form (post name) $value the default value to set for this field, if any $reset is non-blank if the caller requires the field to be reset
Parameters
- $field : mixed
- $fields : mixed
- $value : mixed = ""
- $autoupdate : mixed = false
- $class : mixed = "stdwidth"
- $forsearchbar : mixed = false
- $limit_keywords : mixed = array()
- $searched_nodes : array<string|int, mixed> = array()
-
Array of all the searched nodes previously
- $reset : mixed = ""
- $simpleSearchFieldsAreHidden : mixed = false
render_sort_order()
Renders sort order functionality as a dropdown box
render_sort_order(array<string|int, mixed> $order_fields, mixed $default_sort_order) : mixed
Parameters
- $order_fields : array<string|int, mixed>
- $default_sort_order : mixed
render_dropdown_option()
Renders a dropdown option
render_dropdown_option(mixed $value, mixed $label[, array<string|int, mixed> $data_attr = array() ][, mixed $extra_tag_attributes = '' ]) : mixed
Parameters
- $value : mixed
- $label : mixed
- $data_attr : array<string|int, mixed> = array()
- $extra_tag_attributes : mixed = ''
render_actions()
Renders search actions functionality as a dropdown box
render_actions(array<string|int, mixed> $collection_data[, bool $top_actions = true ][, bool $two_line = true ][, string $id = '' ][, array<string|int, mixed> $resource_data = array() ][, bool $optionsonly = false ][, string $forpage = "" ]) : void
Parameters
- $collection_data : array<string|int, mixed>
-
Collection data
- $top_actions : bool = true
-
Set to true if actions are to be rendered in the search filter bar (above results)
- $two_line : bool = true
-
Display on two lines
- $id : string = ''
-
Selector HTML ID
- $resource_data : array<string|int, mixed> = array()
-
Resource data
- $optionsonly : bool = false
-
Render only options
- $forpage : string = ""
-
Specifically target for which page actions apply
render_user_group_multi_select()
render_user_group_multi_select(string $name[, array<string|int, mixed> $current = array() ][, int $size = 10 ][, mixed $style = '' ]) : mixed
Parameters
- $name : string
- $current : array<string|int, mixed> = array()
-
Current selected values (eg. array(1, 3) for Admins and Super admins user groups selected)
- $size : int = 10
-
How many options to show before user has to scroll
- $style : mixed = ''
render_user_group_checkbox_select()
Renders a list of user groups
render_user_group_checkbox_select(string $name[, array<string|int, mixed> $current = array() ][, string $style = '' ]) : void
Parameters
- $name : string
- $current : array<string|int, mixed> = array()
-
Current selected values (eg. array(1, 3) for Admins and Super admins user groups selected)
- $style : string = ''
-
CSS styling that will apply to the outer container (ie. table element)
render_text_question()
render_text_input_question - Used to display a question with simple text input
render_text_question(string $label, string $input[, string $additionaltext = "" ][, bool $numeric = false ][, mixed $extra = "" ][, mixed $current = "" ][, array<string|int, mixed> $ctx = array() ]) : void
Parameters
- $label : string
-
Label of question
- $input : string
-
Name of input field
- $additionaltext : string = ""
-
Text to to display after input
- $numeric : bool = false
-
Set to true to force numeric input
- $extra : mixed = ""
- $current : mixed = ""
- $ctx : array<string|int, mixed> = array()
-
Rendering context. Should be used to inject different elements (e.g set the div class)
render_split_text_question()
render_split_text_question - Used to display a question with two inputs e.g. for a from/to range
render_split_text_question(string $label[, array<string|int, mixed> $inputs = array() ][, string $additionaltext = "" ][, bool $numeric = false ][, mixed $extra = "" ][, mixed $currentvals = array() ]) : mixed
Parameters
- $label : string
-
Label of question
- $inputs : array<string|int, mixed> = array()
-
Array of input names and labels(eg. array('pixelwidthmin'=>'From','pixelwidthmin'=>'To')
- $additionaltext : string = ""
-
(optional) Text to to display after input
- $numeric : bool = false
-
Set to true to force numeric input
- $extra : mixed = ""
- $currentvals : mixed = array()
render_dropdown_question()
render_dropdown_question - Used to display a question with a dropdown selector
render_dropdown_question(string $label, string $inputname[, array<string|int, mixed> $options = array() ][, string|array<int, int> $current = "" ][, string $extra = "" ][, array{no_div_class_question?: bool, div_class?: list, div_content?: string, div_extra_attr?: string, input_class?: string, onchange?: string} $ctx = array() ]) : void
IMPORTANT: careful when having to handle untrusted data! If you have to pass it to elements, make sure they're encoded accordingly.
Parameters
- $label : string
-
Label of question
- $inputname : string
-
Name of input field
- $options : array<string|int, mixed> = array()
-
Array of options (value and text pairs) (eg. array('pixelwidthmin'=>'From','pixelwidthmin'=>'To')
- $current : string|array<int, int> = ""
-
The current selected value. For a multiple selector, a list of currently selected values.
- $extra : string = ""
-
Extra attributes used on the selector element
-
$ctx
: array{no_div_class_question?: bool, div_class?: list
, div_content?: string, div_extra_attr?: string, input_class?: string, onchange?: string} = array() -
Rendering context. Should be used to inject different elements (e.g set the div class, add onchange for select).
render_access_key_tr()
Render a table row (tr) for a single access key
render_access_key_tr(array<string|int, mixed> $record) : void
Parameters
- $record : array<string|int, mixed>
-
Access key record details
is_field_displayed()
Checks whether a specified field should be displayed based on various conditions.
is_field_displayed(array<string|int, mixed> $field) : bool
This function evaluates several criteria to determine if a field is visible in the resource editing interface. It takes into account the field's active status, permissions for viewing and editing, upload conditions, and any custom hooks that may hide the field.
Parameters
- $field : array<string|int, mixed>
-
The field configuration array containing information about the field's settings.
Return values
bool —Returns true if the field should be displayed; false otherwise.
display_field()
Displays a field in the resource edit interface.
display_field(int $n, array<string|int, mixed> $field[, bool $newtab = false ][, bool $modal = false ]) : mixed
This function handles the rendering of various types of fields based on their configurations and context. It supports multiple modes, such as batch editing, and adjusts the display based on user permissions, errors from previous saves, and whether the field is being copied from another resource.
Parameters
- $n : int
-
The index of the field in the form.
- $field : array<string|int, mixed>
-
The field configuration array containing settings and metadata for the field.
- $newtab : bool = false
-
Indicates if the field should be displayed in a new tab.
- $modal : bool = false
-
Indicates if the field is part of a modal dialog.
render_date_range_field()
Renders a date range input field for resource editing.
render_date_range_field(string $name, string $value[, bool $forsearch = true ][, bool $autoupdate = false ][, array<string|int, mixed> $field = array() ][, string $reset = "" ]) : mixed
This function creates a set of input fields for selecting a start and end date. It supports EDTF format and includes validation for the entered dates. It also provides functionality for handling multiple edit modes and integrates with the autosave feature.
Parameters
- $name : string
-
The base name for the input fields.
- $value : string
-
The value of the date range (in a specific format).
- $forsearch : bool = true
-
Indicates if the field is being used for a search query.
- $autoupdate : bool = false
-
Indicates if the field should trigger an update on change.
- $field : array<string|int, mixed> = array()
-
The field configuration array containing settings and metadata for the field.
- $reset : string = ""
-
An optional parameter indicating if the form should be reset.
renderBreadcrumbs()
Renders a full breadcrumbs trail.
renderBreadcrumbs(array<string|int, mixed> $links[, string $pre_links = '' ][, string $class = '' ]) : void
Parameters
- $links : array<string|int, mixed>
-
List of link "objects" that create the trail
- $pre_links : string = ''
-
Pre-rendered links in HTML form
- $class : string = ''
-
Extra classes for the main container div
render_new_featured_collection_cta()
Render a blank tile used for call to actions (e.g: on featured collections, a tile for creating new collections)
render_new_featured_collection_cta(string $url, array<string|int, mixed> $ctx) : void
Parameters
- $url : string
-
URL
- $ctx : array<string|int, mixed>
-
Rendering options determined by the outside context
renderSocialMediaShareLinksForUrl()
Renders social media links in order to share a particular link
renderSocialMediaShareLinksForUrl(string $url) : void
Parameters
- $url : string
-
The URL to be shared on social media networks
renderLockButton()
Renders a lock button for a field - used to 'lock' metadata in upload_review_mode
renderLockButton(string $name[, array<string|int, mixed> $locked_fields = array() ]) : void
Parameters
- $name : string
-
The field identifier e.g. 'resource_type', '18'
- $locked_fields : array<string|int, mixed> = array()
-
- Array of locked field identifiers
render_resource_image()
Renders an image, with width and height specified for centering in div
render_resource_image(array<string|int, mixed> $resource, string $img_url[, string $display = "thumbs" ]) : void
Parameters
- $resource : array<string|int, mixed>
-
An array of resource data from search results
- $img_url : string
-
URL to image file
- $display : string = "thumbs"
-
size to use - from search results
calculate_image_display()
Calculations width, height and margin-top property for resource image to display in ResourcePanel
calculate_image_display(array{'thumb_width': positive-int, 'thumb_height': positive-int} $imagedata, string $img_url[, string $display = "thumbs" ]) : array<string|int, mixed>
Parameters
- $imagedata : array{'thumb_width': positive-int, 'thumb_height': positive-int}
- $img_url : string
- $display : string = "thumbs"
Return values
array<string|int, mixed> —Returns a tuple of width, height and margin
render_share_options()
Render the share options (used on collection_share.php and resource_share.php)
render_share_options([array<string|int, mixed> $shareopts = array() ]) : void
Parameters
- $shareopts : array<string|int, mixed> = array()
-
Array of share options. If not set will use the old getval() methods "password" bool Has a password been set for this share? (password will not actually be displayed) "editaccesslevel" int Current access level of share "editexpiration" string Current expiration date "editgroup" int ID of existing share group
render_field_selector_question()
Renders a metadata field selector
render_field_selector_question(string $label, string $name, array<string|int, mixed> $ftypes[, string $class = "stdwidth" ][, bool $hidden = false ][, array<string|int, mixed> $current = 0 ]) : void
Parameters
- $label : string
-
label for the field
- $name : string
-
name of form select
- $ftypes : array<string|int, mixed>
-
Array of integer field type ids to include. See definitions.php. Will return all types if incorrect value or empty array supplied.
- $class : string = "stdwidth"
-
array CSS class to apply
- $hidden : bool = false
-
optionally hide the question usng CSS display:none
- $current : array<string|int, mixed> = 0
-
Current selected value
render_filter_bar_button()
Render a filter bar button
render_filter_bar_button(string $text, string $attr, string $icon) : void
Parameters
- $text : string
-
Button text
- $attr : string
-
Button attributes
- $icon : string
-
HTML for icon element (e.g "")
render_upload_here_button()
Render "Upload here" button.
render_upload_here_button(array{search: string, restypes: string, archive: string, advsearch?: "true"|""} $search_params[, bool $return_params_only = false ]) : void|array<string|int, mixed>
This applies to search results that are either a special search "!collection" and/or consist of purely the following:
- Nodes
- Resource type
- Workflow (archive) state
For free text searches this SHOULD NOT work!
Parameters
- $search_params : array{search: string, restypes: string, archive: string, advsearch?: "true"|""}
- $return_params_only : bool = false
-
Exception to the rule! Rather than render, return the upload here params
Return values
void|array<string|int, mixed>render_trash()
Renders the trash bin. This is used to delete dash tiles and remove resources from collections
render_trash(string $type, mixed $deletetext[, mixed $forjs = false ]) : string|void
Parameters
- $type : string
-
type of trash_bin
- $deletetext : mixed
- $forjs : mixed = false
Return values
string|voidrender_help_link()
Generates a help icon that opens the relevant Knowledge Base article in a modal
render_help_link([string $page = '' ][, bool $return_string = false ]) : mixed
Parameters
- $page : string = ''
-
Knowledge Base article to display, leave blank to show the Knowledge Base homepage
- $return_string : bool = false
-
Set to true to return the html as a single line string, False will cause the function to echo the html
Return values
mixed —if $return_string=true return is string, else void
render_question_div()
Render generic Question div (including clearleft)
render_question_div(mixed $id, callable $render_content) : void
Parameters
- $id : mixed
- $render_content : callable
render_custom_fields()
Render custom fields (NOT metadata fields)
render_custom_fields(array<string|int, mixed> $cfs) : true
Parameters
- $cfs : array<string|int, mixed>
-
Custom fields information (as returned by process_custom_fields_submission function)
Return values
truerender_selected_resources_counter()
Generates HTML for the "X Selected" in the search results found part pointing to the special collection COLLECTION_TYPE_SELECTION
render_selected_resources_counter(int $i) : string
Parameters
- $i : int
-
Counter to display
Return values
string —Returns HTML
render_edit_selected_btn()
Renders the "Edit selected" button. This is using the special 'COLLECTION_TYPE_SELECTION' collection
render_edit_selected_btn() : void
render_clear_selected_btn()
Renders the "Clear selected" button. This is using the special 'COLLECTION_TYPE_SELECTION' collection
render_clear_selected_btn() : void
render_selected_collection_actions()
Render the actions specific to when a user selected resources (using the special "COLLECTION_TYPE_SELECTION" collection)
render_selected_collection_actions() : void
render_user_collection_select()
render_user_collection_select([mixed $name = "collection" ][, mixed $collections = array() ][, mixed $selected = 0 ][, mixed $classes = "" ][, mixed $onchangejs = "" ]) : mixed
Parameters
- $name : mixed = "collection"
- $collections : mixed = array()
- $selected : mixed = 0
- $classes : mixed = ""
- $onchangejs : mixed = ""
render_csrf_data_attributes()
Render CSRF information as data attributes. Useful to allow JS to run state changing operations
render_csrf_data_attributes(mixed $ident) : mixed
Parameters
- $ident : mixed
check_display_condition()
Check display condition for a field.
check_display_condition(int $n, array<string|int, mixed> $field, array<string|int, mixed> $fields, bool $render_js, int $resource_ref) : bool
Parameters
- $n : int
-
Question sequence number on the rendered form
- $field : array<string|int, mixed>
-
Field on which we check display conditions
- $fields : array<string|int, mixed>
-
Resource field data and properties as returned by get_resource_field_data()
- $render_js : bool
-
Set to TRUE to render the client side code for checking display conditions or FALSE otherwise
- $resource_ref : int
-
Resource reference for which the display condition applies
Tags
Return values
bool —Returns TRUE if no display condition or if field should be displayed or FALSE if field should not be displayed.
display_upload_options()
Utility to if collapsable upload options should be displayed
display_upload_options() : bool
Return values
booldisplay_field_data()
display_field_data(array<string|int, mixed> $field[, mixed $valueonly = false ][, mixed $fixedwidth = 452 ]) : mixed
Parameters
- $field : array<string|int, mixed>
- $valueonly : mixed = false
- $fixedwidth : mixed = 452
render_fixed_list_as_pills()
render_fixed_list_as_pills(mixed $nodes) : string
Parameters
- $nodes : mixed
Return values
stringrender_resource_lock_link()
render_resource_lock_link(mixed $ref, mixed $lockuser, mixed $editaccess) : mixed
Parameters
- $ref : mixed
- $lockuser : mixed
- $editaccess : mixed
EditNav()
EditNav - render html for next/back browsing on the resource edit page. Called by SaveAndClearButtons()
EditNav() : void
SaveAndClearButtons()
Render the 'QuestionSubmit' div with the 'Save', 'Clear' and 'Save all with values' locked Buttons - used by the resource edit page
SaveAndClearButtons([string $extraclass = "" ][, bool $requiredfields = false ][, bool $backtoresults = false ]) : void
Parameters
- $extraclass : string = ""
-
- Additional CSS classes to add to the Question div
- $requiredfields : bool = false
-
- to indicate the input is required
- $backtoresults : bool = false
-
- Show the next/back links using EditNav()
display_size_option()
display_size_option
display_size_option(mixed $sizeID, mixed $sizeName[, mixed $fordropdown = true ][, mixed $selected = false ]) : void
Parameters
- $sizeID : mixed
- $sizeName : mixed
- $fordropdown : mixed = true
- $selected : mixed = false
render_featured_collection_category_selector()
Render the featured collection category selector
render_featured_collection_category_selector(int $parent, array<string|int, mixed> $context) : void
Parameters
- $parent : int
-
Parent collection ref
- $context : array<string|int, mixed>
-
Contextual data (e.g depth level to render or the current branch path)
render_featured_collections()
Render featured collections (as tiles on the collections_featured.php page)
render_featured_collections(array<string|int, mixed> $ctx, array<string|int, mixed> $items) : mixed
Parameters
- $ctx : array<string|int, mixed>
-
Context data to allow caller code to decide rendering requirements
- $items : array<string|int, mixed>
-
List of items to render (featured collection category, actual collection or smart collection)
render_featured_collection()
Render a featured collection (as tiles on the collections_featured.php page)
render_featured_collection(array<string|int, mixed> $ctx, array<string|int, mixed> $fc) : void
Parameters
- $ctx : array<string|int, mixed>
-
Context data to allow caller code to decide rendering requirements
- $fc : array<string|int, mixed>
-
Featured collection data structure
render_top_right_menu_btn()
Render the top right menu button ellipsis icon.
render_top_right_menu_btn(array<string|int, mixed> $options) : void
Parameters
- $options : array<string|int, mixed>
render_featured_collection_context_menu()
Render a featured collection (category) contextual menu
render_featured_collection_context_menu(string $id, array<string|int, mixed> $options) : void
Parameters
- $id : string
-
The HTML identifier for the menu container.
- $options : array<string|int, mixed>
DrawOption()
Renders an option in the Permission Manager (admin_group_permissions.php page)
DrawOption(string $permission, string $description[, bool $reverse = false ][, bool $reload = false ][, bool $disabled = false ]) : void
Parameters
- $permission : string
-
Permission identifier
- $description : string
-
User friendly description of the permission
- $reverse : bool = false
-
Reverse the permission
- $reload : bool = false
-
deprecated - Autosave changes done on this permission
- $disabled : bool = false
-
Disable this permission as another supersedes it (greys it out and checks it)
render_featured_collections_category_permissions()
Render featured collections options in the Permission Manager (admin_group_permissions.php page)
render_featured_collections_category_permissions(array<string|int, mixed> $ctx) : void
This function will generate and render the following permissions that target featured collection categories
j[numeric ID of new collection] - valid for FC categories at root level. These are normal permissions.
-j[numeric ID of new collection] - valid for the rest of FC sub-categories. These permissions are reversed, DrawOption()!
Parameters
- $ctx : array<string|int, mixed>
-
Context data to allow caller code to start from different tree levels. Supports the following properties: parent and depth
show_upgrade_in_progress()
show_upgrade_in_progress message
show_upgrade_in_progress([bool $dbstructonly = false ]) : void
Parameters
- $dbstructonly : bool = false
-
- Indicates whether this is a full upgrade with migration scripts or just a check_db_structs()
render_audio_download_link()
add link to mp3 preview file if resource is a wav file
render_audio_download_link(array<string|int, mixed> $resource, int $ref, string $k, array<string|int, mixed> $ffmpeg_audio_extensions, string $baseurl, array<string|int, mixed> $lang) : mixed
Parameters
- $resource : array<string|int, mixed>
-
- resource data
- $ref : int
-
- resource ref
- $k : string
-
- url param key
- $ffmpeg_audio_extensions : array<string|int, mixed>
-
- config var containing a list of extensions which will be ported to mp3 format for preview
- $baseurl : string
-
- config base url
- $lang : array<string|int, mixed>
-
- array containing language strings
render_table()
Render a table based on ResourceSpace data to include sorting by various columns
render_table(array<string|int, mixed> $tabledata) : void
Parameters
- $tabledata : array<string|int, mixed>
-
- This must be constructed as detailed below
Required elements:-
"class" Optional class to add to table div "headers" - Column headings using the identifier as the index,
- name - Title to display
- Sortable - can column be sorted?
- width - Optional column width
"orderbyname" - name of variable used on page to determine orderby (used to differentiate from standard search values) "orderby" - Current order by value "sortbyname" - name of variable used on page to determine sort "sort" - Current sort "defaulturl" - Default URL to construct links "modal" - Open links in modal? (false by default) "params" - Current parameters to use in URL "pager" - Pager settings
- current page
- total pages "data" - Array of data to display in table, using header identifers as indexes
- If "rowid" is specified this will be used as the id attribute for the
element - The "alerticon" can be used to specify a CSS class to use for a row status icon
- An additional 'tools' element can be included to add custom action icons
- "icon" - Lucide class to use for icon
- "text" - title attribute
- "url" - URl to link to
- "url:class" - The styling classes for the URL. Type: string. This tool property is optional.
- "modal" - (boolean) Open link in modal?
- "onclick" - OnClick action to add to icon
e.g.
array( "icon"=>"icon-trash-2", "text"=>$lang["action-delete"], "url"=>"", "modal"=>false, "onclick"=>"delete_job(" . $jobs[$n]["ref"] . ");return false;" );
array( "icon"=>"icon-info", "text"=>$lang["job_details"], "url"=>generateURL($baseurl . "/pages/job_details.php",array("job" => $jobs[$n]["ref"])), "modal"=>true, );
render_array_in_table_cells()
Render multimensional array or object to display within table cells
render_array_in_table_cells(array<string|int, mixed> $array) : voidParameters
- $array : array<string|int, mixed>
render_top_page_error_style()
Render the top page error style version
render_top_page_error_style(string $err_msg) : voidParameters
- $err_msg : string
-
Error message
render_question_form_helper()
Render a FormHelper. These are used in forms, to provide extra information to the user to a question.
render_question_form_helper(string $txt, string $id, array<string|int, mixed> $ctx) : mixedParameters
- $txt : string
-
Help text
- $id : string
-
Div ID
- $ctx : array<string|int, mixed>
-
Contextual data
render_hidden_input()
Render an HTML hidden input
render_hidden_input(string $name, string $value) : mixedParameters
- $name : string
-
Input name
- $value : string
-
Input value
render_workflow_state_question()
Renders a dropdown for selecting the workflow state of a resource.
render_workflow_state_question([int|null $current = null ][, bool $checkaccess = true ]) : mixedThis function generates a dropdown menu with various workflow states, allowing the user to select the current state of the resource. The available options are based on permission checks and additional states defined globally.
Parameters
- $current : int|null = null
-
The currently selected state, if any.
- $checkaccess : bool = true
-
Indicates whether to check user permissions for each state.
render_share_password_question()
Renders a question field for setting a share password.
render_share_password_question([bool $blank = true ]) : mixedThis function generates an HTML input field where users can set or change the password for shared access to a resource. It includes functionality to toggle password visibility and indicates if the password is required.
Parameters
- $blank : bool = true
-
Indicates if the password field should be left blank (default is true).
radio_get_layout()
Get required rows and columns for use when displaying radio buttons in a table
radio_get_layout(array<string|int, mixed> $options) : array<string|int, mixed>Parameters
- $options : array<string|int, mixed>
-
Array of text options
Return values
array<string|int, mixed> —(Number of rows, number of columns)
render_radio_buttons_question()
render_radio_buttons_question - Used to display a question with radio buttons
render_radio_buttons_question(string $label, string $inputname[, array<string|int, mixed> $options = array() ][, string $current = "" ][, string $extra = "" ][, bool $listview = false ][, array<string|int, mixed> $ctx = array() ]) : voidParameters
- $label : string
-
Label of question
- $inputname : string
-
Name of input field
- $options : array<string|int, mixed> = array()
-
Array of options (value and text pairs) (eg. array('pixelwidthmin'=>'From','pixelwidthmin'=>'To')
- $current : string = ""
-
The current selected value
- $extra : string = ""
-
Extra attributes used on the selector element
- $listview : bool = false
-
Show as vertical list? (false for table view)
- $ctx : array<string|int, mixed> = array()
-
Rendering context. Should be used to inject different elements (e.g set the div class, add onclick for select)
render_message()
Render a user message for use in conversation view
render_message([array<string|int, mixed> $message = "" ]) : voidParameters
- $message : array<string|int, mixed> = ""
-
Message data from message_get_conversation()
render_antispam_question()
Render the antispam Question form section
render_antispam_question() : mixedrender_fixed_text_question()
Renders a 'fixed' text question - not an input but to display information or values that cannot be changed
render_fixed_text_question(string $label, string $text[, string $helptext = "" ][, string $divid = "" ]) : voidParameters
- $label : string
-
Question label
- $text : string
-
Fixed text
- $helptext : string = ""
-
Optional div identifier
- $divid : string = ""
escape()
Output encoding for HTML context when unsafe input is rendered inside it
escape(string $unsafe) : stringParameters
- $unsafe : string
Return values
stringencode_js_value()
Output encoding for Javascript (JS) context. Allows PHP code to embed data as a JS value by producing a JS-compatible literal for the common JSON types.
encode_js_value(mixed $unsafe) : stringIMPORTANT: encoding failures result in NULL.
Parameters
- $unsafe : mixed
Tags
Return values
stringhtml_break_long_words()
HTML aware function to break up long words onto multiple lines for PDF generation where CSS text wrapping can't be used
html_break_long_words(string $html, int $length) : stringParameters
- $html : string
-
HTML/text to be processed
- $length : int
-
Maximum word length
Return values
stringrender_lucide_icon_selector()
Renders a Lucide icon selector question Requires lib/lucide/icon_classes.php to be included in the page using the function
render_lucide_icon_selector([string $label = "" ][, string $name = "icon" ][, string $current = "" ]) : voidParameters
- $label : string = ""
- $name : string = "icon"
-
Input name
- $current : string = ""
-
Current value
display_related_resources()
Render all related resources on view page
display_related_resources(array<string|int, mixed> $context) : voidParameters
- $context : array<string|int, mixed>
-
Array with all required info from the view page
admin_resource_type_field_constraint()
Display appropriate field constraint for use on admin_resource_type_field_edit.php e.g. single select/Number
admin_resource_type_field_constraint(int $ref, int $currentvalue) : voidParameters
- $ref : int
- $currentvalue : int
admin_resource_type_field_option()
Render metadata field option input on admin_resource_type_field_edit.php
admin_resource_type_field_option(string $propertyname, string $propertytitle, string $helptext, mixed $type, mixed $currentvalue, int $fieldtype, bool $system_date_field) : voidParameters
- $propertyname : string
-
Field property/column name
- $propertytitle : string
-
Title
- $helptext : string
-
Help text
- $type : mixed
-
Input type (0=text,1=boolean,2=text area)
- $currentvalue : mixed
-
Current field setting
- $fieldtype : int
-
Field type. See definitions.php
- $system_date_field : bool
-
Is this field set as the system $date_field?
render_resource_type_selector_question()
Renders a resource type selection dropdown
render_resource_type_selector_question(string $label, string $name[, string $class = "stdwidth" ][, bool $hidden = false ][, int $current = 0 ]) : voidParameters
- $label : string
-
label for the field
- $name : string
-
name of form select
- $class : string = "stdwidth"
-
array CSS class to apply
- $hidden : bool = false
-
optionally hide the question usng CSS display:none
- $current : int = 0
-
Current selected value
add_download_column()
Render the Download info for the resource tool (on view page)
add_download_column(int $ref, array<string|int, mixed> $size_info, bool $downloadthissize[, bool $view_in_browser = false ]) : mixedParameters
- $ref : int
-
Resource ref
- $size_info : array<string|int, mixed>
-
Preview size information
- $downloadthissize : bool
-
Should the size be downloadable or requested?
- $view_in_browser : bool = false
-
Allow the size to be viewed directly in the browser
render_resource_view_image()
Render image on view.php
render_resource_view_image(array<string|int, mixed> $resource, array<string|int, mixed> $context) : voidParameters
- $resource : array<string|int, mixed>
-
Resource data
- $context : array<string|int, mixed>
-
Array with following named elements "access" - Resource access "edit_access" - Resource edit access
render_resource_tools_size_download_options()
Render the resource tools for preview sizes
render_resource_tools_size_download_options(array<string|int, mixed> $resource, array{'download_multisize': bool, "sizes"?: array, 'urlparams': array} $ctx) : voidParameters
- $resource : array<string|int, mixed>
-
Resource data - get_resource_data()
- $ctx : array{'download_multisize': bool, "sizes"?: array, 'urlparams': array}
-
Contextual information.
toast_notification()
Adds script to display toast notification. Note: Must be included after header.php.
toast_notification(ToastNotificationType $type, string $message) : voidParameters
- $type : ToastNotificationType
-
Options are: 'success', 'error' or 'download'. Determines toast notification icon.
- $message : string
-
Notification text to display.
render_icon_wrapper_component()
render_icon_wrapper_component(Icon $name[, IconSize $size = IconSize::Default ]) : voidParameters
- $name : Icon
- $size : IconSize = IconSize::Default
render_header_links()
Render the header's primary navigation. In responsive mode, all the nav links are being overflown.
render_header_links(Icon, force_overflow?: bool} $ctx) : voidParameters
- $ctx : Icon, force_overflow?: bool}
-
Change behaviour based on context (e.g. normal vs responsive)
get_smart_fc_branch_trail()
Helper function for smart featured collections to update $branch_trail with all parent nodes of the selected node
get_smart_fc_branch_trail(int $node, int $tree_node_level, array<string|int, mixed> $field_data, array<string|int, mixed> $general_url_params, array<string|int, mixed> $branch_trail) : array<string|int, mixed>Parameters
- $node : int
-
Node selected
- $tree_node_level : int
-
Current level of node in tree
- $field_data : array<string|int, mixed>
-
Array of the smart featured collections field data
- $general_url_params : array<string|int, mixed>
-
URL parameters to use with generated href links
- $branch_trail : array<string|int, mixed>
-
Partial array of links to use for renderBreadcrumbs(), only includes the highest level link
Return values
array<string|int, mixed> —$branch_trail Full array of parent nodes and field links
Search results