-
Notifications
You must be signed in to change notification settings - Fork 7
Column & Column Toolbar hooks
Benjamin Intal edited this page Apr 3, 2015
·
3 revisions
Deprecated in favor of: Adding Toolbar Buttons
Prepend HTML to add in the column toolbar. The function should echo out valid template HTML.
add_filter( 'pbs_column_toolbar_pre', 'test_add_button' ); function test_add_button( $toolbarHtml ) { echo '
'; }
# `pbs_column_toolbar_post` action
Append HTML to add in the column toolbar. The function should echo out valid template HTML.
##### Examples
> ```
add_filter( 'pbs_column_toolbar_post', 'test_add_button' );
function test_add_button( $toolbarHtml ) {
echo '<div class="dashicons dashicons-images-alt" data-column-action="clone-area" data-mce-bogus="1" title="{{ data.clone_area }}"></div>';
}
Modify the column variables that are used in various locations in the column javascript. The variables mostly contain translatable strings.
This is helpful if you want to add/modify values found in the column toolbar or modals.
-
$columnVars
An associative array of keys & values used in column templates and scripts
Adding a variable
add_filter( 'pbs_column_vars', 'test_column_vars' ); function test_column_vars( $vars ) { $vars['foo'] = 'Bar'; return $vars; }
>
> *Adding a translatable string into a new toolbar button*
> ```
add_filter( 'pbs_column_toolbar_post', 'test_add_button' );
function test_add_button( $toolbarHtml ) {
echo '<div class="dashicons dashicons-images-alt" data-column-action="clone-area" data-mce-bogus="1" title="{{ data.foo }}"></div>';
}
>
> add_filter( 'pbs_column_vars', 'test_column_vars' );
function test_column_vars( $vars ) {
$vars['foo'] = 'Bar';
return $vars;
}