PHP Class WPCOM_VIP_Jetpack_Mandatory, vip-mu-plugins-public

Show file Open project: Automattic/vip-mu-plugins-public Class Usage Examples

Protected Properties

Property Type Description
$mandatory_modules array An array of mandatory module names

Public Methods

Method Description
__construct ( ) Class constructor. Handles hooking actions and filters.
action_admin_footer ( ) Hooks the WP admin_footer action to add our list table JS template.
action_admin_footer_early ( ) Hooks the WP admin_footer action early to output JSON encoded JS data listing the mandatory modules, this is used by our JS template.
action_load_jetpack_modules ( ) =====
add_mandatory_modules ( array $modules ) : array Takes an array of module slugs and adds our mandatory modules if they are not already present.
filter_jetpack_get_default_modules ( array $modules ) : array Hooks the JP jetpack_get_default_modules filter to add in our mandatory modules to the array.
filter_pre_update_option_jetpack_active_modules ( array $modules ) : array Hooks the WP pre_update filter on the jetpack_active_modules option to add in our mandatory modules to the array.
get_mandatory_modules ( ) : array A getter for the mandatory_modules property.
init ( ) : WPCOM_VIP_Jetpack_Mandatory Initiate an instance of this class if one doesn't exist already. Return the WPCOM_VIP_Jetpack_Mandatory instance.
js_templates ( ) Provides a JS template for the JP module listing template. This overrides the JP template of the same purpose.

Method Details

__construct() public method

Class constructor. Handles hooking actions and filters.
public __construct ( )

action_load_jetpack_modules() public method

=====

add_mandatory_modules() public method

Takes an array of module slugs and adds our mandatory modules if they are not already present.
public add_mandatory_modules ( array $modules ) : array
$modules array An array of Jetpack module slugs
return array An array of Jetpack module slugs

filter_jetpack_get_default_modules() public method

Hooks the JP jetpack_get_default_modules filter to add in our mandatory modules to the array.
public filter_jetpack_get_default_modules ( array $modules ) : array
$modules array An array of Jetpack module slugs
return array An array of Jetpack module slugs

filter_pre_update_option_jetpack_active_modules() public method

Hooks the WP pre_update filter on the jetpack_active_modules option to add in our mandatory modules to the array.
public filter_pre_update_option_jetpack_active_modules ( array $modules ) : array
$modules array An array of Jetpack module slugs
return array An array of Jetpack module slugs

get_mandatory_modules() public method

A getter for the mandatory_modules property.
public get_mandatory_modules ( ) : array
return array An array of mandatory Jetpack module slugs

init() public static method

Initiate an instance of this class if one doesn't exist already. Return the WPCOM_VIP_Jetpack_Mandatory instance.
public static init ( ) : WPCOM_VIP_Jetpack_Mandatory
return WPCOM_VIP_Jetpack_Mandatory object The instance of WPCOM_VIP_Jetpack_Mandatory

js_templates() public method

This template is copied from the Jetpack_Modules_List_Table::js_templates with minor tweaks to not show the deactivate button if the module is mandatory.
public js_templates ( )

Property Details

$mandatory_modules protected property

An array of mandatory module names
protected array $mandatory_modules
return array