Skip to main content

GravityView_Entry_Approval_Status

There are specific values of entry approval that are valid. This class holds them and manages access to them.

Since: 1.18

Source: includes/class-gravityview-entry-approval-status.php:23

Details

  • Kind: class
  • Namespace: (global)

Methods

MethodDescription
get_all()Return array of status options
get_values()Get the status values as an array
maybe_convert_status()Convert previously-used values to the current values, for backward compatibility.
is_valid()Check whether the passed value is one of the defined values for entry approval
is_approved()
is_disapproved()
is_unapproved()
get_labels()Get the labels for the status choices
get_label()Get the label for a specific approval value
get_action()Get the label for a specific approval value
get_string()Get the label for a specific approval value
get_title_attr()Get the label for a specific approval value
get_key()Get the status key for a value

Method Reference

get_all()

public static function get_all()

Return array of status options

Returns

  • array — Associative array of available statuses

See Also

  • GravityView_Entry_Approval_Status::get_choices

Source: includes/class-gravityview-entry-approval-status.php:96

get_values()

public static function get_values()

Get the status values as an array

Returns

  • array — Array of values for approval status choices

Since: 1.18

Source: includes/class-gravityview-entry-approval-status.php:107

maybe_convert_status()

public static function maybe_convert_status( $old_value='' )

Convert previously-used values to the current values, for backward compatibility.

Parameters

NameTypeDefaultDescription
$old_valuestring''The status

Returns

  • int — Status value (1 for approved, 2 for disapproved, or 3 for unapproved).

Since: 1.18

Source: includes/class-gravityview-entry-approval-status.php:125

is_valid()

public static function is_valid( $value=null )

Check whether the passed value is one of the defined values for entry approval

Parameters

NameTypeDefaultDescription
$valuemixednull

Returns

  • bool — True: value is valid; false: value is not valid

Since: 1.18

Source: includes/class-gravityview-entry-approval-status.php:172

is_approved()

public static function is_approved( $status )

Parameters

NameTypeDefaultDescription
$statusmixedValue to check approval of

Returns

  • bool — True: passed $status matches approved value

Since: 1.18

Source: includes/class-gravityview-entry-approval-status.php:190

is_disapproved()

public static function is_disapproved( $status )

Parameters

NameTypeDefaultDescription
$statusmixedValue to check approval of

Returns

  • bool — True: passed $status matches disapproved value

Since: 1.18

Source: includes/class-gravityview-entry-approval-status.php:204

is_unapproved()

public static function is_unapproved( $status )

Parameters

NameTypeDefaultDescription
$statusmixedValue to check approval of

Returns

  • bool — True: passed $status matches unapproved value

Since: 1.18

Source: includes/class-gravityview-entry-approval-status.php:218

get_labels()

public static function get_labels()

Get the labels for the status choices

Returns

  • array — Array of labels for the status choices ("Approved", "Disapproved")

Since: 1.18

Source: includes/class-gravityview-entry-approval-status.php:232

get_label()

public static function get_label( $value_or_key )

Get the label for a specific approval value

Parameters

NameTypeDefaultDescription
$value_or_keyint | stringValid status value or key (1 or "approved")

Returns

  • string | false — Label of value ("Approved"). If invalid value, return false.

Since: 1.18

Source: includes/class-gravityview-entry-approval-status.php:286

get_action()

public static function get_action( $value_or_key )

Get the label for a specific approval value

Parameters

NameTypeDefaultDescription
$value_or_keyint | stringValid status value or key (1 or "approved")

Returns

  • string | false — Action of value (eg: "Reset Approval"). If invalid value, return false.

Since: 2.17

Source: includes/class-gravityview-entry-approval-status.php:299

get_string()

public static function get_string( $value_or_key, $string_key='' )

Get the label for a specific approval value

Parameters

NameTypeDefaultDescription
$value_or_keyint | stringValid status value or key (1 or "approved")
$string_key''

Returns

  • string | false — Label of value ("Approved"). If invalid value, return false.

Since: 1.18

Source: includes/class-gravityview-entry-approval-status.php:312

get_title_attr()

public static function get_title_attr( $value_or_key )

Get the label for a specific approval value

Parameters

NameTypeDefaultDescription
$value_or_keyint | stringValid status value or key (1 or "approved")

Returns

  • string | false — Label of value ("Approved"). If invalid value, return false.

Since: 1.18

Source: includes/class-gravityview-entry-approval-status.php:325

get_key()

public static function get_key( $value )

Get the status key for a value

Parameters

NameTypeDefaultDescription
$valueintStatus value (1, 2, 3)

Returns

  • string | false — The status key at status $value, if exists. If not exists, false.

Source: includes/class-gravityview-entry-approval-status.php:336