The gform_entries_view Gravity Forms action triggers when viewing an entry with a non-standard entry type.
Usage
add_action('gform_entries_view', 'my_function', 10, 3);
Parameters
- $view (string): The current entry type.
- $form_id (string): The ID of the form that the entry belongs to.
- $entry_id (string): The ID of the current entry.
More information
See Gravity Forms Docs: gform_entries_view
This action hook is located in gravityforms.php.
Examples
Display custom entry view
if (rgget('view') == 'my_view') {
add_action('gform_entries_view', 'display_custom_entry_view', 10, 3);
function display_custom_entry_view($view, $form_id, $entry_id) {
// Display the view for this custom entry type
}
}
Display custom data based on entry type
add_action('gform_entries_view', 'display_custom_data', 10, 3);
function display_custom_data($view, $form_id, $entry_id) {
if ($view == 'custom_data') {
// Display custom data based on entry type
}
}
Modify the entry view based on user role
add_action('gform_entries_view', 'modify_entry_view_based_on_user_role', 10, 3);
function modify_entry_view_based_on_user_role($view, $form_id, $entry_id) {
if (current_user_can('editor')) {
// Modify the entry view for editors
}
}
Check if custom view is enabled for specific form
add_action('gform_entries_view', 'check_custom_view_for_form', 10, 3);
function check_custom_view_for_form($view, $form_id, $entry_id) {
if ($form_id == '5' && $view == 'custom_view') {
// Execute custom code for specific form
}
}
Display custom error message for unsupported view
add_action('gform_entries_view', 'display_error_message_for_unsupported_view', 10, 3);
function display_error_message_for_unsupported_view($view, $form_id, $entry_id) {
if ($view == 'unsupported_view') {
echo 'This entry view is not supported.';
}
}