Support

Search results for ""

Sorry, no results found. Perhaps you would like to search the documentation?
All Topics
Jeff Gabrielson

“Custom” example – “Play” action button

Hi there! I’m just wondering how we go about adding a custom action button to a list, as shown in your “Custom” example where you see a “Play” button as a column. That’s new! How do I do that?

1 year, 3 months ago
Stefan
Developer

It is an example of what is possible with our plugin.
We don’t have an actual column that does exactly that.
But with our hooks it is possible to change a custom field column into a play button.
The code would look something like this (missing the needed checks)

add_filter( 'ac/column/value', function( $value, $id, AC\Column $column ){
	if( $column instanceof AC\Column\Meta ){
		// Check for specific meta key and file type
		$value = sprintf('<audio controls><source src="%s" type="audio/mpeg"></audio>', $value );
	}

	return $value;
}, 10, 3 );

More information about the used hook can be found here:

ac/column/value

1 year, 3 months ago

You must be logged in to reply to this topic.