vB_Api_Widget
extends vB_Api
in package
vB_Api_Widget
Tags
Table of Contents
- CLEAR_CACHE_EVENT = 'widget_clear_cache'
- WIDGETCATEGORY_ABSTRACT = 'Abstract'
- WIDGETCATEGORY_SYSTEM = 'System'
- $controller : string
- API Controller
- $db : vB_Database
- Database object.
- $disabled : bool
- Indicates whether the API was disabled
- $disableFalseReturnOnly : array<string|int, mixed>
- Contains white listed methods which return a false response when API is disabled in special scenarios like forum closed, password expiry, ip ban and others.
- $disableWhiteList : array<string|int, mixed>
- Contains white listed methods which act as normal when API is disabled no matter of special scenarios like forum closed, password expiry, ip ban and others.
- $nonPlaceableWidgetCategories : mixed
- $pagetemplateid : mixed
- $preloadWidgetIds : mixed
- $sectionnumber : mixed
- $instances : mixed
- $instancesRaw : array<string|int, mixed>
- We want API subclasses to access the instances only through getters
- $vb4_input_mappings : mixed
- $wrappers : mixed
- __serialize() : mixed
- __sleep() : mixed
- __unserialize() : mixed
- __wakeup() : mixed
- callNamed() : The
- Call the given api function by name with a named arguments list.
- checkApiState() : mixed
- This method checks whether the API method is enabled.
- clearCache() : mixed
- Clears all previously loaded API objects.
- clearCaches() : mixed
- deleteWidgetInstance() : false|int
- Deletes a widget instance
- deleteWidgetInstances() : false|int
- Deletes multiple widget instances
- fetchAdminConfig() : array<string|int, mixed>|false
- Returns the admin configuration for a specific widget instance.
- fetchChannelConfig() : array<string|int, mixed>|false
- Returns the channel configuration for a specific widget instance.
- fetchChannelWidgetAdminConfig() : mixed
- Returns the structure which was previously stored in the adminconfig field of widgetinstancetable
- fetchConfig() : array<string|int, mixed>
- Returns the final configuration for a specific widget instance.
- fetchConfigAndIsUserEditable() : mixed
- fetchConfigSchema() : array<string|int, mixed>
- Returns the widget configuration schema for the given widget instance.
- fetchDefaultConfig() : array<string|int, mixed>
- Returns the default configuration for a specific widget instance.
- fetchDefaultConfigWithoutInstance() : mixed
- fetchHierarchicalWidgetInstancesByPageTemplateId() : array<string|int, mixed>
- Returns all widget instances that are associated with the given page template id in a hierarchical array indexed by section number.
- fetchLayoutSectionInfo() : array<string|int, mixed>
- Returns an array of info, including the widget instances, to loop over and display all the layout sections.
- fetchPageManagerForums() : mixed
- fetchPageManagerGroups() : mixed
- fetchSearchConfig() : array<string|int, mixed>
- Returns the final configuration for the search widget instance.
- fetchTabbedSubWidgetConfigs() : mixed
- fetchUserConfig() : array<string|int, mixed>|false
- Returns the user configuration for a specific widget instance.
- fetchWidget() : array<string|int, mixed>|false
- Returns the basic widget data for a widget
- fetchWidgetGuidToWidgetidMap() : mixed
- fetchWidgetInstances() : array<string|int, mixed>
- Returns multiple widget instances
- fetchWidgetInstancesByPageTemplateId() : array<string|int, mixed>
- Returns all module instances that are associated with the given page template id. These are the module instances that should shown on that page template. This also includes global module instances (pagetemplateid = -1).
- fetchWidgetInstanceTemplates() : mixed
- fetchWidgets() : array<string|int, mixed>
- Returns the basic widget data for multiple widgets
- getApiClassName() : mixed
- getWidgetDefinition() : array<string|int, mixed>
- fetches the rows from the widgetdefinition table for a widgetid
- instance() : vB_Api
- Returns an instance of the API object which translates exceptions to an array Use this method for API clients.
- instanceInternal() : vB_Api
- Returns an instance of the API object which doesn't handle exceptions This should only be used in other API objects, not for clients of the API
- isSystemWidget() : mixed
- map_vb4_input_to_vb5() : string
- Returns vb5 api method name.
- map_vb5_errors_to_vb4() : mixed
- Alters the error array in any way necessary to interface correctly with vb4.
- map_vb5_output_to_vb4() : mixed
- Alters the output array in any way necessary to interface correctly with vb4.
- renameWidget() : mixed
- Rename custom widget
- saveAdminConfig() : bool
- Saves an admin widget configuration for the given widget instance
- saveChannelConfig() : bool
- Saves a channel widget configuration for the given widget instance
- saveDefaultConfig() : array<string|int, mixed>
- Saves the 'default' config for a widget; updates the widgetdefinitions default field currently only used for customized_copy widgets
- saveForums() : array<string|int, mixed>
- Saves the configuration for the Channel Widget, including creating/saving channels as necessary.
- saveNewWidgetInstance() : bool
- Saves a new widget instance
- saveSearchWidgetConfig() : string
- Saves the configuration for the Search Widget,
- saveWidgetinstanceContainerinstanceid() : array<string|int, mixed>
- Updates information about the module instance, including the containerinstanceid, pagetemplateid, displaysection, and displayorder.
- __construct() : mixed
- _cmpWigetDefFields() : mixed
- compare function for widget definition sorting
- _doGetChannelSelectOptions() : array<string|int, mixed>
- Gets the channel select options for the 'ChannelSelect' config type Recursive function, only called from _getChannelSelectOptions
- _getChannelSelectOptions() : array<string|int, mixed>
- Gets the channel select options for the 'ChannelSelect' config type
- _getContentTypeSelectOptions() : array<string|int, mixed>
- Gets the content type select options for the 'ContentTypeSelect' config type
- _getNewPageTemplateId() : int
- Generates a new page template ID for the new page template that that widgets are being configured for. Needed to be able to generate a widget instance ID for the new widget instance.
- _getNewWidgetInstanceId() : int
- Generates a new widget instance ID for the widget instance being configured.
- _getProfileFieldSelectOptions() : array<string|int, mixed>
- Gets the profile field select options for the 'ProfileFieldSelect' config type
- _getWidgetConfigFields() : array<string|int, mixed>
- Returns the configuration fields needed to configure a widget of this type.
- _getWidgetDefinition() : array<string|int, mixed>
- Returns the config fields that define a widget
- _getWidgetInstance() : array<string|int, mixed>
- Returns stored widget instance data for the given widget instance ID
- addWidgetTitles() : array<string|int, mixed>
- Adds the correct (phrased) widget titles to each widget in the array
- assembleChannelConfig() : mixed
- assemblePageManagerChannelsConfig() : mixed
- channelDisplaySort() : mixed
- checkHasAdminPermission() : none
- Determines if the calling user has the given admin permission, and if not throws an exception
- checkHasPermission() : none
- Determines if the calling user has the given bitfield permission, and if not, throws a 'no_permission' exception.
- checkIsLoggedIn() : mixed
- Determines if the calling user has the given admin permission, and if not throws an exception
- checkProductStatus() : mixed
- cleanWidgetConfigData() : array<string|int, mixed>
- Cleans widget config data
- compareWidgets() : mixed
- getApiClass() : mixed
- getApiClassNameInternal() : mixed
- hasAdminPermission() : bool
- Determines if the calling user has the given admin permission
- inDebugMode() : mixed
- isDisableFalseReturnOnly() : bool
- Checks if method returns false response only when API is disabled.
- isWhiteListed() : bool
- Checks if method is white listed when API is disabled.
- preProcessConfigValues() : array<string|int, mixed>
- Pre-compiles a few specific config values for consumption in templates.
- saveChannel() : int
- Saves (inserts/updates) one channel record. Used by {@see saveChannelWidgetConfig, saveChannels}
- setController() : mixed
- Set controller
- _fetchAndCacheWidgetsForRender() : mixed
- addTitlesRecursive() : mixed
- addWidgetInstanceDisplayInfoToQuery() : mixed
- Updates displayorder for all module instances in this section, and sets displaysection, displayorder, and pagetemplateid in $querydata
- checkProductStatusSingleWidget() : mixed
- clean_config_module_filter_nodes() : mixed
- clean_config_module_viewpermissions() : mixed
- cleaningMethodIsCallable() : mixed
- cms_vb4_to_vb5_method_mapping() : mixed
- default_vb4_to_vb5_method_mapping() : mixed
- doSkipModule() : mixed
- fetchUsergroupsForModuleViewPerms() : mixed
- getWidgetTitlePhrases() : mixed
- hasAdminPermissionInternal() : mixed
- Internal function to power the previous cover functions
- remove_nulls() : mixed
- saveChannels() : array<string|int, mixed>
- Recursively saves all channels in the Channel Widget Used by {@see saveChannelWidgetConfig}
- wrapLoggerIfNeeded() : mixed
- Wrap the api object with the log wrapper class if needed.
Constants
CLEAR_CACHE_EVENT
public
mixed
CLEAR_CACHE_EVENT
= 'widget_clear_cache'
WIDGETCATEGORY_ABSTRACT
public
mixed
WIDGETCATEGORY_ABSTRACT
= 'Abstract'
WIDGETCATEGORY_SYSTEM
public
mixed
WIDGETCATEGORY_SYSTEM
= 'System'
Properties
$controller
API Controller
protected
string
$controller
$db
Database object.
protected
vB_Database
$db
$disabled
Indicates whether the API was disabled
protected
bool
$disabled
= alse
$disableFalseReturnOnly
Contains white listed methods which return a false response when API is disabled in special scenarios like forum closed, password expiry, ip ban and others.
protected
array<string|int, mixed>
$disableFalseReturnOnly
= array()
$disableWhiteList
Contains white listed methods which act as normal when API is disabled no matter of special scenarios like forum closed, password expiry, ip ban and others.
protected
array<string|int, mixed>
$disableWhiteList
= array('fetchConfig', 'fetchHierarchicalWidgetInstancesByPageTemplateId', 'fetchSectionsByPageTemplateId', 'fetchTabbedSubWidgetConfigs', 'fetchDefaultConfigWithoutInstance')
$nonPlaceableWidgetCategories
protected
mixed
$nonPlaceableWidgetCategories
= array('Abstract')
$pagetemplateid
protected
mixed
$pagetemplateid
= 0
$preloadWidgetIds
protected
mixed
$preloadWidgetIds
= array()
$sectionnumber
protected
mixed
$sectionnumber
= -1
$instances
private
static mixed
$instances
$instancesRaw
We want API subclasses to access the instances only through getters
private
static array<string|int, mixed>
$instancesRaw
$vb4_input_mappings
private
static mixed
$vb4_input_mappings
= array(
'blog.post_comment' => array('method' => 'vb4_blog.post_comment'),
'blog.post_postcomment' => array('method' => 'vb4_blog.post_postcomment'),
'blog.post_updateblog' => array('method' => 'vb4_blog.post_updateblog'),
'blog.post_newblog' => array('method' => 'vb4_blog.post_newblog'),
'blog.post_editblog' => array('method' => 'vb4_blog.post_editblog'),
'blog_list' => array('method' => 'vb4_blog.bloglist'),
'api_init' => array('method' => 'api.init'),
'api_cmssectionlist' => array('method' => 'Vb4_Cms.sectionlist'),
'api_cmscategorylist' => array('method' => 'Vb4_Cms.categorylist'),
/*
// These can no longer be mapped directly to vB_Api_User::login/logout
// due to additional processing of devicetoken that may be required
// for mapi calls.
'login_login' => array(
'method' => 'user.login',
'request_mappings' => array(
'vb_login_username' => 'username',
'vb_login_password' => 'password',
'vb_login_md5password' => 'md5password',
'vb_login_md5password_utf' => 'md5passwordutf'
)
),
'login_logout' => array(
'method' => 'user.logout'
),
*/
'get_vbfromfacebook' => array('method' => 'vb4_facebook.getVbfromfacebook'),
)
$wrappers
private
static mixed
$wrappers
Methods
__serialize()
public
__serialize() : mixed
Return values
mixed —__sleep()
public
__sleep() : mixed
Return values
mixed —__unserialize()
public
__unserialize(mixed $serialized) : mixed
Parameters
- $serialized : mixed
Return values
mixed —__wakeup()
public
__wakeup() : mixed
Return values
mixed —callNamed()
Call the given api function by name with a named arguments list.
public
callNamed() : The
Used primarily to translate REST requests into API calls.
Return values
The —return of the method or an error if the method doesn't exist, or is static, a constructor or destructor, or otherwise shouldn't be callable as and API method. It is also an error if the value of a paramater is not provided and that parameter doesn't have a default value.
checkApiState()
This method checks whether the API method is enabled.
public
checkApiState(mixed $method) : mixed
For extensions check make sure $controller property is already set.
Parameters
- $method : mixed
Return values
mixed —clearCache()
Clears all previously loaded API objects.
public
static clearCache() : mixed
Intended for use in tests where the loading pattern can cause issues with objects that cache thier own data.
Return values
mixed —clearCaches()
public
clearCaches() : mixed
Return values
mixed —deleteWidgetInstance()
Deletes a widget instance
public
deleteWidgetInstance(mixed $widgetInstanceId) : false|int
Parameters
- $widgetInstanceId : mixed
Return values
false|int —False or 0 on failure, 1 on success
deleteWidgetInstances()
Deletes multiple widget instances
public
deleteWidgetInstances(array<string|int, mixed> $widgetInstanceIds[, mixed $updateParents = false ]) : false|int
Parameters
- $widgetInstanceIds : array<string|int, mixed>
- $updateParents : mixed = false
Return values
false|int —False or 0 on failure, number of rows deleted on success
fetchAdminConfig()
Returns the admin configuration for a specific widget instance.
public
fetchAdminConfig(mixed $widgetinstanceid) : array<string|int, mixed>|false
Parameters
- $widgetinstanceid : mixed
Return values
array<string|int, mixed>|false —An associative array of the widget config items and their values False if there is no admin config for this widget
fetchChannelConfig()
Returns the channel configuration for a specific widget instance.
public
fetchChannelConfig(mixed $widgetinstanceid, mixed $nodeId) : array<string|int, mixed>|false
Parameters
- $widgetinstanceid : mixed
- $nodeId : mixed
Return values
array<string|int, mixed>|false —An associative array of the widget config items and their values, or false if there is no channel config for this widget and channel.
fetchChannelWidgetAdminConfig()
Returns the structure which was previously stored in the adminconfig field of widgetinstancetable
public
fetchChannelWidgetAdminConfig(mixed $channelIds) : mixed
Parameters
- $channelIds : mixed
Return values
mixed —fetchConfig()
Returns the final configuration for a specific widget instance.
public
fetchConfig(mixed $widgetinstanceid, mixed $userid, mixed $channelId) : array<string|int, mixed>
Parameters
- $widgetinstanceid : mixed
- $userid : mixed
- $channelId : mixed
Return values
array<string|int, mixed> —An associative array of the widget config items and their values
fetchConfigAndIsUserEditable()
public
fetchConfigAndIsUserEditable(mixed $widgetinstanceid, mixed $widgetid[, mixed $guid = '' ], mixed $userid, mixed $channelId[, mixed $withTemplate = false ]) : mixed
Parameters
- $widgetinstanceid : mixed
- $widgetid : mixed
- $guid : mixed = ''
- $userid : mixed
- $channelId : mixed
- $withTemplate : mixed = false
Return values
mixed —fetchConfigSchema()
Returns the widget configuration schema for the given widget instance.
public
fetchConfigSchema(mixed $widgetid, mixed $widgetinstanceid, mixed $pagetemplateid[, mixed $configtype = 'admin' ], mixed $userid) : array<string|int, mixed>
If no widget instance ID is given, one is created. If no page template ID is given, one is created (to be able to create the widget instance). If the widget instance ID is given, the returned config fields will contain the current values of the configured widget instance for the config type specified.
Parameters
- $widgetid : mixed
- $widgetinstanceid : mixed
- $pagetemplateid : mixed
- $configtype : mixed = 'admin'
- $userid : mixed
Return values
array<string|int, mixed> —An array containing widgetid, widgetinstanceid, pagetemplateid, and an array of config fields to generate the edit configuration form
fetchDefaultConfig()
Returns the default configuration for a specific widget instance.
public
fetchDefaultConfig(mixed $widgetinstanceid) : array<string|int, mixed>
Parameters
- $widgetinstanceid : mixed
Return values
array<string|int, mixed> —An associative array of the widget config items and their values
fetchDefaultConfigWithoutInstance()
public
fetchDefaultConfigWithoutInstance(mixed $widgetid[, mixed $guid = '' ][, mixed $withTemplate = true ]) : mixed
Parameters
- $widgetid : mixed
- $guid : mixed = ''
- $withTemplate : mixed = true
Return values
mixed —fetchHierarchicalWidgetInstancesByPageTemplateId()
Returns all widget instances that are associated with the given page template id in a hierarchical array indexed by section number.
public
fetchHierarchicalWidgetInstancesByPageTemplateId(mixed $pagetemplateid, mixed $channelId[, mixed $admincheck = false ]) : array<string|int, mixed>
These are the widget instances that should shown on that page template.
Parameters
- $pagetemplateid : mixed
- $channelId : mixed
- $admincheck : mixed = false
Return values
array<string|int, mixed> —The array of sections with widget instance data, empty on failure
fetchLayoutSectionInfo()
Returns an array of info, including the widget instances, to loop over and display all the layout sections.
public
fetchLayoutSectionInfo(mixed $pagetemplateid, mixed $channelId) : array<string|int, mixed>
Parameters
- $pagetemplateid : mixed
- $channelId : mixed
Return values
array<string|int, mixed> —The array of sections with widget instance data, empty on failure
fetchPageManagerForums()
public
fetchPageManagerForums() : mixed
Return values
mixed —fetchPageManagerGroups()
public
fetchPageManagerGroups([mixed $channel = 'groups' ][, mixed $page = 1 ]) : mixed
Parameters
- $channel : mixed = 'groups'
- $page : mixed = 1
Return values
mixed —fetchSearchConfig()
Returns the final configuration for the search widget instance.
public
fetchSearchConfig(mixed $widgetinstanceid, mixed $userid, mixed $widgetid) : array<string|int, mixed>
Parameters
- $widgetinstanceid : mixed
- $userid : mixed
- $widgetid : mixed
Return values
array<string|int, mixed> —An associative array of the widget config items and their values
fetchTabbedSubWidgetConfigs()
public
fetchTabbedSubWidgetConfigs(mixed $containerinstanceid) : mixed
Parameters
- $containerinstanceid : mixed
Return values
mixed —fetchUserConfig()
Returns the user configuration for a specific widget instance.
public
fetchUserConfig(mixed $widgetinstanceid, mixed $userid) : array<string|int, mixed>|false
Parameters
- $widgetinstanceid : mixed
- $userid : mixed
Return values
array<string|int, mixed>|false —An associative array of the widget config items and their values, or false if there is no user config for this widget and user.
fetchWidget()
Returns the basic widget data for a widget
public
fetchWidget(mixed $widgetid) : array<string|int, mixed>|false
Parameters
- $widgetid : mixed
Return values
array<string|int, mixed>|false —The array of widget data, or false on failure
fetchWidgetGuidToWidgetidMap()
public
fetchWidgetGuidToWidgetidMap() : mixed
Return values
mixed —fetchWidgetInstances()
Returns multiple widget instances
public
fetchWidgetInstances(array<string|int, mixed> $widgetInstanceIds) : array<string|int, mixed>
Parameters
- $widgetInstanceIds : array<string|int, mixed>
Return values
array<string|int, mixed> —The array of widget instance data, indexed by widgetinstanceid, empty on failure
fetchWidgetInstancesByPageTemplateId()
Returns all module instances that are associated with the given page template id. These are the module instances that should shown on that page template. This also includes global module instances (pagetemplateid = -1).
public
fetchWidgetInstancesByPageTemplateId(mixed $pagetemplateid[, mixed $sectionnumber = -1 ], mixed $channelId[, mixed $admincheck = false ]) : array<string|int, mixed>
Parameters
- $pagetemplateid : mixed
- $sectionnumber : mixed = -1
- $channelId : mixed
- $admincheck : mixed = false
Return values
array<string|int, mixed> —The array of widget instance data, empty on failure
fetchWidgetInstanceTemplates()
public
fetchWidgetInstanceTemplates(mixed $modules) : mixed
Parameters
- $modules : mixed
Return values
mixed —fetchWidgets()
Returns the basic widget data for multiple widgets
public
fetchWidgets([array<string|int, mixed> $widgetids = array() ][, mixed $removeNonPlaceableWidgets = false ]) : array<string|int, mixed>
Parameters
- $widgetids : array<string|int, mixed> = array()
- $removeNonPlaceableWidgets : mixed = false
Return values
array<string|int, mixed> —The array of widget data, indexed by widgetid, empty on failure
getApiClassName()
public
static getApiClassName(mixed $controller) : mixed
Parameters
- $controller : mixed
Return values
mixed —getWidgetDefinition()
fetches the rows from the widgetdefinition table for a widgetid
public
getWidgetDefinition(int $widgetid) : array<string|int, mixed>
Parameters
- $widgetid : int
Return values
array<string|int, mixed> —instance()
Returns an instance of the API object which translates exceptions to an array Use this method for API clients.
public
static instance(string $controller[, bool $refresh_cache = false ]) : vB_Api
Parameters
- $controller : string
-
-- name of the API controller to load
- $refresh_cache : bool = false
-
-- true if we want to force the cache to update with a new api object primarily intended for testing
Return values
vB_Api —instanceInternal()
Returns an instance of the API object which doesn't handle exceptions This should only be used in other API objects, not for clients of the API
public
static instanceInternal(string $controller[, bool $refresh_cache = false ]) : vB_Api
Parameters
- $controller : string
-
-- name of the API controller to load
- $refresh_cache : bool = false
-
-- true if we want to force the cache to update with a new api object primarily intended for testing
Return values
vB_Api —isSystemWidget()
public
isSystemWidget(mixed $widgetId) : mixed
Parameters
- $widgetId : mixed
Return values
mixed —map_vb4_input_to_vb5()
Returns vb5 api method name.
public
static map_vb4_input_to_vb5(string $method, array<string|int, mixed> &$request) : string
May alter request array.
Parameters
- $method : string
-
-- vb4 method name
- $request : array<string|int, mixed>
-
-- $_REQUEST array for this api request
Return values
string —map_vb5_errors_to_vb4()
Alters the error array in any way necessary to interface correctly with vb4.
public
static map_vb5_errors_to_vb4(string $method, array<string|int, mixed> &$data) : mixed
Parameters
- $method : string
-
-- vb4 method name
- $data : array<string|int, mixed>
-
-- error array from vb5
Return values
mixed —map_vb5_output_to_vb4()
Alters the output array in any way necessary to interface correctly with vb4.
public
static map_vb5_output_to_vb4(string $method, array<string|int, mixed> &$data) : mixed
Parameters
- $method : string
-
-- vb4 method name
- $data : array<string|int, mixed>
-
-- output array from vb5
Return values
mixed —renameWidget()
Rename custom widget
public
renameWidget( $widgetId, mixed $newtitle) : mixed
Parameters
Return values
mixed —saveAdminConfig()
Saves an admin widget configuration for the given widget instance
public
saveAdminConfig(mixed $widgetid, mixed $pagetemplateid, mixed $widgetinstanceid, mixed $data[, mixed $displaysection = null ][, mixed $displayafterwidgetinstanceid = null ]) : bool
Parameters
- $widgetid : mixed
- $pagetemplateid : mixed
- $widgetinstanceid : mixed
- $data : mixed
- $displaysection : mixed = null
- $displayafterwidgetinstanceid : mixed = null
Return values
bool —Whether or not the widget configuration was saved.
saveChannelConfig()
Saves a channel widget configuration for the given widget instance
public
saveChannelConfig(mixed $widgetinstanceid, mixed $nodeid, mixed $data) : bool
Parameters
- $widgetinstanceid : mixed
- $nodeid : mixed
- $data : mixed
Return values
bool —Whether or not the widget configuration was saved.
saveDefaultConfig()
Saves the 'default' config for a widget; updates the widgetdefinitions default field currently only used for customized_copy widgets
public
saveDefaultConfig(mixed $widgetid, array<string|int, mixed> $data) : array<string|int, mixed>
Parameters
- $widgetid : mixed
- $data : array<string|int, mixed>
Return values
array<string|int, mixed> —saveForums()
Saves the configuration for the Channel Widget, including creating/saving channels as necessary.
public
saveForums(mixed $data) : array<string|int, mixed>
Parameters
- $data : mixed
Return values
array<string|int, mixed> —Array of information to display the channel widget config interface
saveNewWidgetInstance()
Saves a new widget instance
public
saveNewWidgetInstance(mixed $containerinstanceid, mixed $widgetid, mixed $pagetemplateid[, mixed $subWidgetConfig = [] ][, mixed $displaysection = null ][, mixed $displayafterwidgetinstanceid = null ]) : bool
Parameters
- $containerinstanceid : mixed
- $widgetid : mixed
- $pagetemplateid : mixed
- $subWidgetConfig : mixed = []
- $displaysection : mixed = null
- $displayafterwidgetinstanceid : mixed = null
Return values
bool —Whether or not the widget configuration was saved.
saveSearchWidgetConfig()
Saves the configuration for the Search Widget,
public
saveSearchWidgetConfig(mixed $data) : string
Parameters
- $data : mixed
Return values
string —search JSON string
saveWidgetinstanceContainerinstanceid()
Updates information about the module instance, including the containerinstanceid, pagetemplateid, displaysection, and displayorder.
public
saveWidgetinstanceContainerinstanceid(mixed $widgetinstanceid, mixed $containerinstanceid, mixed $pagetemplateid, mixed $displaysection, mixed $displayafterwidgetinstanceid) : array<string|int, mixed>
Parameters
- $widgetinstanceid : mixed
- $containerinstanceid : mixed
- $pagetemplateid : mixed
- $displaysection : mixed
- $displayafterwidgetinstanceid : mixed
Return values
array<string|int, mixed> —Result
__construct()
protected
__construct() : mixed
Return values
mixed —_cmpWigetDefFields()
compare function for widget definition sorting
protected
_cmpWigetDefFields(mixed $f1, mixed $f2) : mixed
Parameters
- $f1 : mixed
- $f2 : mixed
Return values
mixed —_doGetChannelSelectOptions()
Gets the channel select options for the 'ChannelSelect' config type Recursive function, only called from _getChannelSelectOptions
protected
_doGetChannelSelectOptions(mixed $channels, mixed $indent) : array<string|int, mixed>
Parameters
- $channels : mixed
- $indent : mixed
Return values
array<string|int, mixed> —Channel select option data
_getChannelSelectOptions()
Gets the channel select options for the 'ChannelSelect' config type
protected
_getChannelSelectOptions() : array<string|int, mixed>
Return values
array<string|int, mixed> —Channel select option data
_getContentTypeSelectOptions()
Gets the content type select options for the 'ContentTypeSelect' config type
protected
_getContentTypeSelectOptions() : array<string|int, mixed>
Return values
array<string|int, mixed> —Content type select option data
_getNewPageTemplateId()
Generates a new page template ID for the new page template that that widgets are being configured for. Needed to be able to generate a widget instance ID for the new widget instance.
protected
_getNewPageTemplateId() : int
Return values
int —New page template ID
_getNewWidgetInstanceId()
Generates a new widget instance ID for the widget instance being configured.
protected
_getNewWidgetInstanceId(mixed $widgetid, mixed $pagetemplateid, mixed $containerinstanceid) : int
Parameters
- $widgetid : mixed
- $pagetemplateid : mixed
- $containerinstanceid : mixed
Return values
int —New widget instance ID
_getProfileFieldSelectOptions()
Gets the profile field select options for the 'ProfileFieldSelect' config type
protected
_getProfileFieldSelectOptions() : array<string|int, mixed>
Return values
array<string|int, mixed> —Profile field select option data
_getWidgetConfigFields()
Returns the configuration fields needed to configure a widget of this type.
protected
_getWidgetConfigFields(mixed $widgetid, mixed $widgetinstanceid[, mixed $configtype = '' ], mixed $userid) : array<string|int, mixed>
If the widget instance ID is given, it will also set the current values for the config fields to the current configured values for the widget instance.
Parameters
- $widgetid : mixed
- $widgetinstanceid : mixed
- $configtype : mixed = ''
- $userid : mixed
Return values
array<string|int, mixed> —An associative array, keyed by the config field name and containing name, label, type, default value, is editable, and is required with which the config fields can be displayed.
_getWidgetDefinition()
Returns the config fields that define a widget
protected
_getWidgetDefinition(mixed $widgetid) : array<string|int, mixed>
Parameters
- $widgetid : mixed
Return values
array<string|int, mixed> —The config fields
_getWidgetInstance()
Returns stored widget instance data for the given widget instance ID
protected
_getWidgetInstance(mixed $widgetinstanceid) : array<string|int, mixed>
Parameters
- $widgetinstanceid : mixed
Return values
array<string|int, mixed> —Array of widget instance data
addWidgetTitles()
Adds the correct (phrased) widget titles to each widget in the array
protected
addWidgetTitles(mixed $widgets) : array<string|int, mixed>
Parameters
- $widgets : mixed
Return values
array<string|int, mixed> —The same array of widgets with the title phrases added.
assembleChannelConfig()
protected
assembleChannelConfig(mixed $nodes) : mixed
Parameters
- $nodes : mixed
Return values
mixed —assemblePageManagerChannelsConfig()
protected
assemblePageManagerChannelsConfig(mixed $nodes) : mixed
Parameters
- $nodes : mixed
Return values
mixed —channelDisplaySort()
protected
channelDisplaySort(mixed $ch1, mixed $ch2) : mixed
Parameters
- $ch1 : mixed
- $ch2 : mixed
Return values
mixed —checkHasAdminPermission()
Determines if the calling user has the given admin permission, and if not throws an exception
protected
checkHasAdminPermission(string|array<string|int, mixed> $adminPermission) : none
Checks for:
- A valid CP Session
- The passed adminpermission.
Parameters
- $adminPermission : string|array<string|int, mixed>
-
The admin permission to check. If an array then the check passes if the user has any of the permissions given.
Tags
Return values
none —checkHasPermission()
Determines if the calling user has the given bitfield permission, and if not, throws a 'no_permission' exception.
protected
checkHasPermission(string $group, string $permission) : none
Parameters
- $group : string
-
The permission group where the permission is located
- $permission : string
-
The permission to check
Tags
Return values
none —checkIsLoggedIn()
Determines if the calling user has the given admin permission, and if not throws an exception
protected
checkIsLoggedIn() : mixed
Return values
mixed —checkProductStatus()
protected
checkProductStatus(mixed &$widgets, mixed $depth) : mixed
Parameters
- $widgets : mixed
- $depth : mixed
Return values
mixed —cleanWidgetConfigData()
Cleans widget config data
protected
cleanWidgetConfigData(mixed $widgetid, mixed $data, mixed $allowArbitraryData) : array<string|int, mixed>
Parameters
- $widgetid : mixed
- $data : mixed
- $allowArbitraryData : mixed
Return values
array<string|int, mixed> —The cleaned widget data
compareWidgets()
protected
static compareWidgets(mixed $widget1, mixed $widget2) : mixed
Parameters
- $widget1 : mixed
- $widget2 : mixed
Return values
mixed —getApiClass()
protected
static getApiClass(mixed $controller[, mixed $errorCheck = true ]) : mixed
Parameters
- $controller : mixed
- $errorCheck : mixed = true
Return values
mixed —getApiClassNameInternal()
protected
static getApiClassNameInternal(mixed $controller) : mixed
Parameters
- $controller : mixed
Return values
mixed —hasAdminPermission()
Determines if the calling user has the given admin permission
protected
hasAdminPermission(string|array<string|int, mixed> $adminPermission) : bool
Useful if you need to know if the calling user but do not care why they do not have that permission. Generally useful if there is a behavior difference between admins and non admins, but the call can be processed for either.
Parameters
- $adminPermission : string|array<string|int, mixed>
-
The admin permission to check. If an array then the check passes if the user has any of the permissions given.
Return values
bool —true if checks pass, false otherwise
inDebugMode()
protected
inDebugMode() : mixed
Return values
mixed —isDisableFalseReturnOnly()
Checks if method returns false response only when API is disabled.
protected
isDisableFalseReturnOnly(mixed $method) : bool
Parameters
- $method : mixed
Return values
bool —Indicates whether method returns false response only.
isWhiteListed()
Checks if method is white listed when API is disabled.
protected
isWhiteListed(mixed $method) : bool
Parameters
- $method : mixed
Return values
bool —Indicates whether method is or is not a white list.
preProcessConfigValues()
Pre-compiles a few specific config values for consumption in templates.
protected
preProcessConfigValues(mixed $widgetConfig) : array<string|int, mixed>
This greatly simplifies some of the template logic needed.
Parameters
- $widgetConfig : mixed
Return values
array<string|int, mixed> —Array of config values with pre-processed items added.
saveChannel()
Saves (inserts/updates) one channel record. Used by {@see saveChannelWidgetConfig, saveChannels}
protected
saveChannel(mixed $nodeid, array<string|int, mixed> $data) : int
Parameters
- $nodeid : mixed
- $data : array<string|int, mixed>
Return values
int —Channel Node ID
setController()
Set controller
protected
setController(mixed $controller) : mixed
Parameters
- $controller : mixed
Return values
mixed —_fetchAndCacheWidgetsForRender()
private
_fetchAndCacheWidgetsForRender(mixed $widgetids) : mixed
Parameters
- $widgetids : mixed
Return values
mixed —addTitlesRecursive()
private
addTitlesRecursive(mixed &$widgets, mixed $vbphrases, mixed $depth) : mixed
Parameters
- $widgets : mixed
- $vbphrases : mixed
- $depth : mixed
Return values
mixed —addWidgetInstanceDisplayInfoToQuery()
Updates displayorder for all module instances in this section, and sets displaysection, displayorder, and pagetemplateid in $querydata
private
addWidgetInstanceDisplayInfoToQuery(mixed &$querydata, mixed $pagetemplateid, mixed $displaysection, mixed $displayafterwidgetinstanceid) : mixed
Parameters
- $querydata : mixed
- $pagetemplateid : mixed
- $displaysection : mixed
- $displayafterwidgetinstanceid : mixed
Return values
mixed —checkProductStatusSingleWidget()
private
checkProductStatusSingleWidget(mixed &$widget, mixed $products) : mixed
Parameters
- $widget : mixed
- $products : mixed
Return values
mixed —clean_config_module_filter_nodes()
private
clean_config_module_filter_nodes(mixed $data) : mixed
Parameters
- $data : mixed
Return values
mixed —clean_config_module_viewpermissions()
private
clean_config_module_viewpermissions(mixed $data) : mixed
Parameters
- $data : mixed
Return values
mixed —cleaningMethodIsCallable()
private
cleaningMethodIsCallable(mixed $method) : mixed
Parameters
- $method : mixed
Return values
mixed —cms_vb4_to_vb5_method_mapping()
private
static cms_vb4_to_vb5_method_mapping(mixed $method, mixed &$request) : mixed
Parameters
- $method : mixed
- $request : mixed
Return values
mixed —default_vb4_to_vb5_method_mapping()
private
static default_vb4_to_vb5_method_mapping(mixed $method) : mixed
Parameters
- $method : mixed
Return values
mixed —doSkipModule()
private
doSkipModule(mixed $widgetinstanceid[, mixed $widgetInstanceConfig = array() ][, mixed $usergroups = array() ]) : mixed
Parameters
- $widgetinstanceid : mixed
- $widgetInstanceConfig : mixed = array()
- $usergroups : mixed = array()
Return values
mixed —fetchUsergroupsForModuleViewPerms()
private
fetchUsergroupsForModuleViewPerms([mixed $userid = null ]) : mixed
Parameters
- $userid : mixed = null
Return values
mixed —getWidgetTitlePhrases()
private
getWidgetTitlePhrases(mixed $widgets, mixed $depth) : mixed
Parameters
- $widgets : mixed
- $depth : mixed
Return values
mixed —hasAdminPermissionInternal()
Internal function to power the previous cover functions
private
hasAdminPermissionInternal(mixed $adminPermission) : mixed
@param string|array $adminPermission The admin permission to check. If an array
then the check passes if the user has any of the permissions given.
Parameters
- $adminPermission : mixed
Return values
mixed —remove_nulls()
private
static remove_nulls(mixed &$data) : mixed
Parameters
- $data : mixed
Return values
mixed —saveChannels()
Recursively saves all channels in the Channel Widget Used by {@see saveChannelWidgetConfig}
private
saveChannels(array<string|int, mixed> $channels[, int $parentid = 1 ]) : array<string|int, mixed>
Parameters
- $channels : array<string|int, mixed>
-
Channel data
- $parentid : int = 1
Return values
array<string|int, mixed> —Channel Information
wrapLoggerIfNeeded()
Wrap the api object with the log wrapper class if needed.
private
static wrapLoggerIfNeeded(mixed $controller, mixed $api_object) : mixed
Parameters
- $controller : mixed
- $api_object : mixed