GravityView  2.17
The best, easiest way to display Gravity Forms entries on your website.
Public Member Functions | Data Fields | Private Member Functions
GravityView_Field_Unsubscribe Class Reference
Inheritance diagram for GravityView_Field_Unsubscribe:
GravityView_Field

Public Member Functions

 __construct ()
 
 add_hooks ()
 Hooks called from constructor. More...
 
 field_options ( $field_options, $template_id, $field_id, $context, $input_type, $form_id)
 Configure the field options. More...
 
 filter_gravityview_entry_default_field ( $entry_default_fields, $form, $context)
 Add the unsubsribe to the configuration fields. More...
 
 maybe_not_visible ( $visible, $field)
 Hide the field from the renderer. More...
 
 modify_entry_value_unsubscribe ( $output, $entry, $field_settings, $field)
 Modify the render content. More...
 
- Public Member Functions inherited from GravityView_Field
 __construct ()
 GravityView_Field constructor. More...
 
 _filter_gform_custom_merge_tags ( $custom_merge_tags=array(), $form_id=0, $fields=array(), $element_id='')
 Add custom merge tags to merge tag options. More...
 
 _filter_gform_replace_merge_tags ( $text, $form=array(), $entry=array(), $url_encode=false, $esc_html=false)
 Match the merge tag in replacement text for the field. More...
 
 _filter_sortable_fields ( $not_sortable)
 Use field settings to modify whether a field is sortable. More...
 
 add_entry_meta ( $entry_meta)
 Add the custom entry meta key to make it searchable and sortable. More...
 
 add_field_support ( $key, &$field_options)
 
 add_sortable_field ( $fields)
 Add the field to the Filter & Sort available fields. More...
 
 as_array ()
 Returns the field as an array to be used in field pickers. More...
 
 field_options ( $field_options, $template_id, $field_id, $context, $input_type, $form_id)
 Tap in here to modify field options. More...
 
 replace_merge_tag ( $matches=array(), $text='', $form=array(), $entry=array(), $url_encode=false, $esc_html=false)
 Run GravityView filters when using GFCommon::replace_variables() More...
 
 set_default_search_label ( $label='', $gf_field=null, $field=array())
 Allow setting a default search label for search fields based on the field type. More...
 

Data Fields

 $contexts = array( 'single', 'multiple' )
 
 $group = 'pricing'
 
 $icon = 'dashicons-cart'
 
 $is_searchable = false
 
 $name = 'unsubscribe'
 
- Data Fields inherited from GravityView_Field
 $_gf_field_class_name
 
 $contexts = array( 'single', 'multiple', 'edit', 'export' )
 
 $default_search_label
 
 $description
 
 $entry_meta_is_default_column = false
 
 $entry_meta_key = null
 
 $entry_meta_update_callback = null
 
 $group
 standard, advanced, post, pricing, meta, gravityview, or add-ons More...
 
 $icon = 'dashicons-admin-generic'
 
 $is_numeric
 boolean Is field content number-based? More...
 
 $is_searchable = true
 
 $is_sortable = true
 boolean Can the field be sorted in search? More...
 
 $label
 
 $name
 
 $search_operators
 

Private Member Functions

 maybe_unsubscribe ( $entry)
 Try to unsubscribe from the entry. More...
 

Additional Inherited Members

- Protected Member Functions inherited from GravityView_Field
 custom_merge_tags ( $form=array(), $fields=array())
 Add custom Merge Tags to Merge Tag options, if custom Merge Tags exist. More...
 
 is_choice_value_enabled ()
 Check whether the enableChoiceValue flag is set for a GF field. More...
 
- Protected Attributes inherited from GravityView_Field
 $_custom_merge_tag = false
 
 $_field_id = ''
 
 $_field_options = array()
 

Detailed Description

Definition at line 9 of file class-gravityview-field-unsubscribe.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( )

Definition at line 21 of file class-gravityview-field-unsubscribe.php.

References add_hooks(), and GV\description.

Member Function Documentation

◆ add_hooks()

add_hooks ( )

Hooks called from constructor.

Returns
void

Definition at line 35 of file class-gravityview-field-unsubscribe.php.

Referenced by __construct().

◆ field_options()

field_options (   $field_options,
  $template_id,
  $field_id,
  $context,
  $input_type,
  $form_id 
)

Configure the field options.

Called from the gravityview_entry_default_fields filter.

Remove the logged in, new window and show as link options. Add the allow unsubscribe for all admins option.

Parameters
array$field_optionsThe options.
string$template_idThe template ID.
int | string | float$field_idThe field ID.
string$contextThe configuration context (edit, single, etc.)
string$input_typeThe input type.
int$form_idThe form ID.
Returns
array The field options.

Definition at line 60 of file class-gravityview-field-unsubscribe.php.

◆ filter_gravityview_entry_default_field()

filter_gravityview_entry_default_field (   $entry_default_fields,
  $form,
  $context 
)

Add the unsubsribe to the configuration fields.

Only if a subscription feed is active for the current form.

Called from gravityview_entry_default_fields

Parameters
array$entry_default_fieldsAn array of available for configuration
array | int$formForm ID or array
string$contextThe configuration context (edit, single, etc.)
Returns
array The array of available default fields.

Definition at line 110 of file class-gravityview-field-unsubscribe.php.

References GV\$form, and GV\description.

◆ maybe_not_visible()

maybe_not_visible (   $visible,
  $field 
)

Hide the field from the renderer.

Perhaps.

Called from gravityview/field/is_visible

Hide the field for non-logged in users for sure.

Parameters
bool$visibleConsider visible or not.
\GV\Field$fieldThe field.
Returns
bool Visible or not.

Definition at line 91 of file class-gravityview-field-unsubscribe.php.

References $field.

◆ maybe_unsubscribe()

maybe_unsubscribe (   $entry)
private

Try to unsubscribe from the entry.

Called during a POST request. Checks nonce, feeds, entry ID. Does not check user permissions. This is left as an exercise for the caller.

Entry View inclusion is checked ad-hoc during the rendering of the field. User permissions are also checked ad-hoc during the rendering process.

Parameters
array$entryThe entry
Returns
array $entry The entry

Definition at line 223 of file class-gravityview-field-unsubscribe.php.

References $entry.

Referenced by modify_entry_value_unsubscribe().

◆ modify_entry_value_unsubscribe()

modify_entry_value_unsubscribe (   $output,
  $entry,
  $field_settings,
  $field 
)

Modify the render content.

Called from gravityview_field_entry_value_unsubscribe

Parameters
string$outputThe output.
array$entryThe entry.
array$field_settingsThe field settings.
\GV\Field$fieldThe field.
Returns
string The content.

Definition at line 169 of file class-gravityview-field-unsubscribe.php.

References $entry, $field_settings, $link, $output, GVCommon\has_cap(), and maybe_unsubscribe().

Field Documentation

◆ $contexts

$contexts = array( 'single', 'multiple' )

Definition at line 17 of file class-gravityview-field-unsubscribe.php.

◆ $group

$group = 'pricing'

Definition at line 13 of file class-gravityview-field-unsubscribe.php.

◆ $icon

$icon = 'dashicons-cart'

Definition at line 19 of file class-gravityview-field-unsubscribe.php.

◆ $is_searchable

$is_searchable = false

Definition at line 15 of file class-gravityview-field-unsubscribe.php.

◆ $name

$name = 'unsubscribe'

Definition at line 11 of file class-gravityview-field-unsubscribe.php.


The documentation for this class was generated from the following file: