Last active
February 24, 2016 00:34
-
-
Save zackkatz/82785402c996b51b4dc9 to your computer and use it in GitHub Desktop.
Add an <optgroup> to Gravity Forms "Bulk action" dropdown using GravityView.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Requires GravityView 1.16.3 or newer | |
*/ | |
add_filter( 'gravityview/approve_entries/bulk_actions', 'gv_approve_entries_bulk_actions_pizzafy', 10, 2 ); | |
/** | |
* Add an <optgroup> to Gravity Forms "Bulk action" dropdown using GravityView. | |
* | |
* @param array $bulk_actions Associative array of actions to be added to "Bulk action" dropdown inside GravityView `<optgroup>`. Parent array key is the `<optgroup>` label, then each child array must have `label` (displayed text) and `value` (input value) keys. Values get sanitized by GV. | |
* @param int $form_id ID of the form currently being displayed | |
* | |
* @return array Bulk actions, with map | |
*/ | |
function gv_approve_entries_bulk_actions_pizzafy( $bulk_actions = array(), $form_id = 0 ) { | |
$bulk_actions['GF Pizza-Pie'] = array( | |
array( | |
'label' => __( 'Send Free Pizzas', 'gravityview' ), | |
'value' => sprintf( 'pizzafy-%d', $form_id ), | |
), | |
); | |
return $bulk_actions; | |
} |
Author
zackkatz
commented
Feb 24, 2016
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment