uo_tin_can_filter_action_label
Filters the label for the Tin Can filter action before it displays.
add_filter( 'uo_tin_can_filter_action_label', $callback, 10, 1 );
Description
Filters the "Action" label used in the Tin Can filter interface. Developers can modify this label to customize the displayed text, perhaps for localization or to use a more specific term depending on their application. The second parameter is reserved and should not be used.
Usage
add_filter( 'uo_tin_can_filter_action_label', 'your_function_name', 10, 1 );
Return Value
The filtered value.
Examples
<?php
/**
* Example of filtering the 'uo_tin_can_filter_action_label' hook.
*
* This function modifies the label displayed for the "action" filter in the
* Tin Can reporting section. It prepends "LRS " to the default label.
*
* @param string $label The current label for the action filter.
* @param mixed $param2 The second parameter passed to the filter (unused in this example).
* @return string The modified label.
*/
add_filter( 'uo_tin_can_filter_action_label', function( $label, $param2 ) {
// Check if the original label is 'action' and if we want to modify it.
if ( $label === esc_html_x( 'action', 'Tin Can Filter Action name', 'uncanny-learndash-reporting' ) ) {
return 'LRS ' . $label;
}
return $label; // Return the original label if no modification is needed.
}, 10, 2 ); // 10 is the priority, 2 is the number of accepted arguments.
?>
Placement
This code should be placed in the functions.php file of your active theme, a custom plugin, or using a code snippets plugin.
Source Code
src/reporting/tin-can/templates/tc-tincan-filter.php:202
src/reporting/tin-can/templates/tc-tincan-filter.php:210
<div class="reporting-tincan-filters-col reporting-tincan-filters-col--3">
<div class="reporting-tincan-section__title">
<?php echo ucfirst( apply_filters( 'uo_tin_can_filter_activity_label', esc_html_x( 'Activity', 'Tin Can Filter Activity name', 'uncanny-learndash-reporting' ), false ) ); ?>
</div>
<div class="reporting-tincan-section__content">
<div class="reporting-tincan-section__field">
<label for="tc_filter_action"><?php echo ucfirst( apply_filters( 'uo_tin_can_filter_action_label', esc_html_x( 'action', 'Tin Can Filter Action name', 'uncanny-learndash-reporting' ), false ) ); ?></label>
<select class="uo-admin-select" name="tc_filter_action" id="tc_filter_action">
<option value="">
<?php
echo esc_html(
sprintf(
/* translators: %s: Course label */
__( 'All %s', 'uncanny-learndash-reporting' ),