bookmark_bordergform_slack_icon

Description

This filter is used to dynamically change the icon being displayed with the message sent to Slack. The icon image size should be 48×48.

apply_filters( 'gform_slack_icon', $this->get_base_url() . '/images/icon.png', $feed, $entry, $form )

Usage

add_filter( 'gform_slack_icon', 'change_slack_icon', 10, 4 );

Parameters

  • $icon_url string

    The current icon being used for the Slack message.

  • $feed Feed Object

    The current feed object.

  • $entry Entry Object

    The current entry object.

  • $form

    The current form object.

Examples

This example changes the icon URL if the form ID is 4.

add_filter( 'gform_slack_icon', 'change_slack_icon', 10, 4 );
function change_slack_icon( $icon_url, $feed, $entry, $form ) {

    if ( $form['id'] == 4 ) {
        $icon_url = 'http://placehold.it/48';
    }

    return $icon_url;
}

Placement

This code should be placed in the functions.php file of your active theme.

Source Code

This filter is located in class-gf-slack.php