9 var
$name =
'entry_approval';
23 var
$icon =
'dashicons-yes-alt';
27 $this->label = esc_attr__(
'Approve Entries',
'gk-gravityview' );
29 $this->
description = esc_attr__(
'Approve and reject entries from the View.',
'gk-gravityview' );
33 parent::__construct();
51 unset( $field_options[
'only_loggedin'] );
53 unset( $field_options[
'new_window'] );
55 unset( $field_options[
'show_as_link'] );
57 return $field_options;
69 add_filter(
'gravityview_entry_default_fields', array( $this,
'filter_gravityview_entry_default_field' ), 10, 3 );
71 add_action(
'wp_enqueue_scripts', array( $this,
'register_scripts_and_styles' ) );
74 add_action(
'gravityview/template/before', array( $this,
'register_scripts_and_styles' ) );
76 add_action(
'gravityview/field/approval/load_scripts', array( $this,
'enqueue_and_localize_script' ) );
78 add_action(
'gravityview_datatables_scripts_styles', array( $this,
'enqueue_and_localize_script' ) );
80 add_filter(
'gravityview_get_entries', array( $this,
'modify_search_parameters' ), 1000 );
82 add_filter(
'gravityview/field_output/html', array( $this,
'maybe_prevent_field_render' ), 10, 2 );
84 add_filter(
'gravityview/field/is_visible', array( $this,
'maybe_not_visible' ), 10, 2 );
100 if( $this->name === \
GV\Utils::get(
$args[
'field'],
'id' ) && !
GVCommon::has_cap(
'gravityview_moderate_entries') ) {
113 if ( $this->name !==
$field->ID ) {
129 if ( $this->name === \
GV\Utils::get( $parameters,
'sorting/key' ) ) {
130 $parameters[
'sorting'][
'key'] =
'is_approved';
145 if ( wp_script_is(
'gravityview-field-approval' ) ) {
149 $script_debug = ( defined(
'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ?
'' :
'.min';
151 wp_register_script(
'gravityview-field-approval',
GRAVITYVIEW_URL .
'assets/js/field-approval'.$script_debug.
'.js', array(
'jquery' ),
GV_PLUGIN_VERSION,
true );
159 if( class_exists(
'GravityView_View' ) ) {
166 $style_url = plugins_url(
'css/field-approval.css', trailingslashit( dirname( $style_path ) ) );
173 $style_url = apply_filters(
'gravityview/field/approval/css_url', $style_url );
175 if( ! empty( $style_url ) ) {
176 wp_register_style(
'gravityview-field-approval', $style_url, array(
'dashicons' ),
GV_PLUGIN_VERSION,
'screen' );
179 unset( $style_path, $style_url );
190 if( wp_script_is(
'gravityview-field-approval',
'enqueued' ) ) {
194 wp_enqueue_style(
'gravityview-field-approval' );
196 wp_enqueue_script(
'gravityview-field-approval' );
197 wp_enqueue_script(
'gravityview-field-approval-tippy' );
198 wp_enqueue_script(
'gravityview-field-approval-popper' );
199 wp_enqueue_style(
'gravityview-field-approval-tippy' );
201 wp_localize_script(
'gravityview-field-approval',
'gvApproval', array(
202 'ajaxurl' => admin_url(
'admin-ajax.php' ),
203 'nonce' => wp_create_nonce(
'gravityview_entry_approval'),
224 if ( ! isset( $entry_default_fields[
"{$this->name}"] ) &&
'edit' !== $context ) {
225 $entry_default_fields[
"{$this->name}"] = array(
226 'label' => $this->label,
228 'type' => $this->name,
232 return $entry_default_fields;
274 return esc_attr(
"gv-approval-{$approved_key}" );
const GRAVITYVIEW_DIR
"GRAVITYVIEW_DIR" "./" The absolute path to the plugin directory, with trailing slash ...
Modify field settings by extending this class.
const GV_PLUGIN_VERSION(! GravityKit\GravityView\Foundation\meets_min_php_version_requirement(__FILE__, '7.2.0'))
Constants.
enqueue_and_localize_script()
Register the field approval script and output the localized text JS variables.
static getInstance( $passed_post=NULL)
new GravityView_Field_Entry_Approval
const GRAVITYVIEW_URL
The URL to this file, with trailing slash.
static get_title_attr( $approved_status)
Get the title attribute for a link, based on the current status.
static get_popover_placement()
Where should the popover be placed?
modify_search_parameters( $parameters)
Modify search to use is_approved meta key to sort, instead of entry_approval
static get_css_class( $approved_status)
Get the CSS class for a link, based on the current status.
static get_key( $value)
Get the status key for a value.
field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id)
Remove unused settings for the approval field.
if(gravityview() ->plugin->is_GF_25()) $form
scale description p description
add_hooks()
Add filters and actions for the field.
register_scripts_and_styles()
Register the field approval script and style.
static get_anchor_text( $approved_status='')
Get the anchor text for a link, based on the current status.
maybe_not_visible( $visible, $field)
Do not show this field if gravityview_moderate_entries capability is absent.
Add custom options for address fields.
filter_gravityview_entry_default_field( $entry_default_fields, $form, $context)
Add Fields to the field list.
static get_string( $value_or_key, $string_key='')
Get the label for a specific approval value.
if(empty( $created_by)) $form_id
static get_popover_template()
Get HTML template for a popover used to display approval statuses.
static get_all()
Return array of status options.
static has_cap( $caps='', $object_id=null, $user_id=null)
Alias of GravityView_Roles_Capabilities::has_cap()
if(false !==strpos( $value, '00:00')) $field_id
string $field_id ID of the field being displayed
maybe_prevent_field_render( $html, $args)