Heads up!
This article contains PHP code and is intended for developers. We offer this code as a courtesy, but don't provide support for code customizations or 3rd party development.
This article contains PHP code and is intended for developers. We offer this code as a courtesy, but don't provide support for code customizations or 3rd party development.
This hook allows to modify the HTML image of each option in FrmAppHelper::images_dropdown() method.
Usage
add_filter( 'frm_images_dropdown_option_image', 'my_custom_function');
Parameters
- $image (string): The HTML image, SVG or font icon.
- $args (array): The arguments of images_dropdown() method after filling defaults and adding option array.
Examples
Use the image URL
Use the image URL passed to image_url in FrmAppHelper::images_dropdown() arguments.
add_filter( 'frm_images_dropdown_option_image', 'use_url_image_dropdown', 10, 2);
function use_url_image_dropdown( $image, $args ) {
if ( ! empty( $args['image_url'] ) ) {
return '<img src="' . esc_url( $args['image_url'] ) . '" />';
}
return $image;
}