Skip to main content

GravityView_Extension

Extend this class to create a GravityView extension that gets updates from gravitykit.com

Since: 1.1

Source: lib/class-gravityview-extension.php:17

Details

  • Kind: class
  • Namespace: (global)

Properties

PropertyTypeDescription
$_titlestringName of the plugin in gravitykit.com
$_versionstringVersion number of the plugin
$_item_idintThe ID of the download on gravitykit.com
$_text_domainstringTranslation textdomain
$_min_gravityview_versionstringMinimum version of GravityView the Extension requires
$_min_php_versionstringMinimum version of GravityView the Extension requires
$_remote_update_urlstringThe URL to fetch license info from. Do not change unless you know what you're doing.
$_authorstringAuthor of plugin, sent when fetching license info.

Methods

MethodDescription
add_metabox_tab()If Extension overrides tab_settings() and passes its own tab, add it to the tabbed settings metabox
load_plugin_textdomain()Load translations for the extension
settings()Register the updater for the Extension using GravityView license information
admin_notice()Outputs the admin notices generated by the plugin
add_notice()Add a notice to be displayed in the admin.
add_hooks()Extensions should override this hook to add their hooks instead of
save_post()Store the filter settings in the _gravityview_filters post meta
tooltips()Add tooltips for the extension.

Method Reference

add_metabox_tab()

function add_metabox_tab()

If Extension overrides tab_settings() and passes its own tab, add it to the tabbed settings metabox

Returns

  • void

Since: 1.8 ((Extension version 1.0.7))

Source: lib/class-gravityview-extension.php:114

load_plugin_textdomain()

public function load_plugin_textdomain()

Load translations for the extension

  1. Check wp-content/languages/gravityview/ folder and load using load_textdomain()
  2. Check wp-content/plugins/gravityview/languages/ folder for gravityview-[locale].mo file and load using load_textdomain()
  3. Load default file using load_plugin_textdomain() from wp-content/plugins/gravityview/languages/

Returns

  • void

Source: lib/class-gravityview-extension.php:161

settings()

public function settings()

Register the updater for the Extension using GravityView license information

Returns

  • void

Source: lib/class-gravityview-extension.php:219

admin_notice()

public function admin_notice()

Outputs the admin notices generated by the plugin

Returns

  • void

Source: lib/class-gravityview-extension.php:232

add_notice()

public static function add_notice( $notice=[] )

Add a notice to be displayed in the admin.

Parameters

NameTypeDefaultDescription
$noticearray[]Array with class and message keys. The message is not escaped.

Source: lib/class-gravityview-extension.php:254

add_hooks()

public function add_hooks()

Extensions should override this hook to add their hooks instead of

Source: lib/class-gravityview-extension.php:271

save_post()

public function save_post( $post_id )

Store the filter settings in the _gravityview_filters post meta

Parameters

NameTypeDefaultDescription
$post_idintPost ID

Returns

  • void

Source: lib/class-gravityview-extension.php:278

tooltips()

public function tooltips( $tooltips=[] )

Add tooltips for the extension.

Add a tooltip with an array using the title and value keys. The title key is the H6 tag value of the tooltip; it's the headline. The value is the tooltip content, and can contain any HTML.

The tooltip key must be gv_{name_of_setting}. If the name of the setting is "example_extension_setting", the code would be:


$tooltips['gv_example_extension_setting'] = array(
'title' => 'About Example Extension Setting',
'value' => 'When you do [x] with [y], [z] happens.'
);

Parameters

NameTypeDefaultDescription
$tooltipsarray[]Existing GV tooltips, with title and value keys

Returns

  • array — Modified tooltips

Source: lib/class-gravityview-extension.php:297