include/connectors/utils/ConnectorUtils.php

Show: inherited
Table of Contents

Constants

Constant  CONNECTOR_DISPLAY_CONFIG_FILE = 'custom/modules/Connectors/metadata/display_config.php'

\ConnectorUtils

Package: SugarCRM

Connector utilities

Api
 

Properties

Propertyprotectedarray  $connectors_cache= ''
static

Cached connectors data

Details
Type
array

Methods

methodpubliccleanMetaDataFile( String $module ) : void
static

When a module has all of the sources removed from it we do not properly remove it from the viewdefs. This function will handle that.

Parameters
Name Type Description
$module String
  • the module in question
methodpubliceapmEnabled( string $id,  $refresh = false ) : void
static

Check if external accounts are enabled for this connector

Parameters
Name Type Description
$id string
$refresh
methodpublicgetConnector( string $id, bool $refresh = false ) : null | array
static

Get connector data by ID

Parameters
Name Type Description
$id string
$refresh bool
Returns
Type Description
null | array Connector data
methodpublicgetConnectorButtonScript( mixed $displayParams, mixed $smarty ) : String
static

getConnectorButtonScript This method builds the HTML code for the hover link field

Parameters
Name Type Description
$displayParams mixed

Array value of display parameters passed from the SugarField code

$smarty mixed

The Smarty object from the calling smarty code

Returns
Type Description
String $code The HTML code for the hover link
methodpublicgetConnectorStrings( String $source_id, String $language = '' ) : void
static

getConnectorStrings This method returns the language Strings for a given connector instance

Parameters
Name Type Description
$source_id String

String value of the connector id to retrive language strings for

$language String

optional String value for the language to use (defaults to $GLOBALS['current_language'])

methodpublicgetConnectors( boolean $refresh = false ) : void
static

getConnectors Returns an Array of the connectors that have been loaded into the system along with attributes pertaining to each connector.

Parameters
Name Type Description
$refresh boolean

boolean flag indicating whether or not to force rewriting the file; defaults to false

Details
Returns
mixed $connectors Array of the connector entries found  
methodpublicgetDisplayConfig(  $refresh = false ) : void
static

getDisplayConfig

Parameters
Name Type Description
$refresh
methodpublicgetMergeViewDefs( boolean $refresh = false ) : mixed
static

getMergeViewDefs Returns an Array of the merge definitions used by the Connector module to merge values into the bean instance

Parameters
Name Type Description
$refresh boolean

boolean value to manually refresh the mergeview definitions

Returns
Type Description
mixed $mergedefs Array of the merge definitions
Details
Deprecated
This method has been replaced by getViewDefs  
methodpublicgetModuleConnectors( String $module ) : array
static

getModuleConnectors

Parameters
Name Type Description
$module String

the module to get the connectors for

Returns
Type Description
array
methodpublicgetSearchDefs( boolean $refresh = false ) : mixed
static

getSearchDefs Returns an Array of the search field defintions Connector module to search entries from the connector. If the searchdefs.php file in the custom directory is not found, it defaults to using the mapping.php file entries to create a default version of the file.

Parameters
Name Type Description
$refresh boolean

boolean value to manually refresh the search definitions

Returns
Type Description
mixed $searchdefs Array of the search definitions
methodprivategetSources( String $directory = 'modules/Connectors/connectors/sources' ) : mixed
static

getSources Returns an Array of source entries found under the given directory

Parameters
Name Type Description
$directory String

The directory to search

Returns
Type Description
mixed $sources An Array of source entries
methodpublicgetViewDefs( mixed $filter_sources = array() ) : mixed
static

getViewDefs Returns an Array of the merge definitions used by the Connector module to merge values into the bean instance

Parameters
Name Type Description
$filter_sources mixed

Array optional Array value of sources to only use

Returns
Type Description
mixed $mergedefs Array of the merge definitions
methodprivatehasWizardSourceEnabledForModule( String $module = '' ) : boolean
static

hasWizardSourceEnabledForModule This is a private method that returns a boolean value indicating whether or not at least one source is enabled for a given module. By enabled we mean that the source has the neccessary configuration properties set as determined by the isRequiredConfigFieldsForButtonSet method. In addition, a check is made to ensure that it is a source that has been enabled for the wizard.

Parameters
Name Type Description
$module String

String value of module to check

Returns
Type Description
boolean $enabled boolean value indicating whether or not module has at least one source enabled
methodpublicinstallSource( String $source ) : boolean
static

installSource Install the name of the source (called from ModuleInstaller.php). Modifies the files in the custom directory to add the new source in.

Parameters
Name Type Description
$source String

String value of the id of the connector to install

Returns
Type Description
boolean $result boolean value indicating whether or not connector was installed
methodpublicisModuleEnabled( String $module ) : boolean
static

isModuleEnabled Given a module name, checks to see if the module is enabled to be serviced by the connector module

Parameters
Name Type Description
$module String

String name of the module

Returns
Type Description
boolean $enabled boolean value indicating whether or not the module is enabled to be serviced by the connector module
methodpublicisSourceEnabled( String $source ) : boolean
static

isSourceEnabled Given a source id, checks to see if the source is enabled for at least one module

Parameters
Name Type Description
$source String

String name of the source

Returns
Type Description
boolean $enabled boolean value indicating whether or not the source is displayed in at least one module
methodpublicremoveHoverField(  $viewdefs,  $module ) : void

Parameters
Name Type Description
$viewdefs
$module
methodpublicsaveConnectors( array $connectors, string $toFile = '' ) : bool
static

Save connectors array to file

Parameters
Name Type Description
$connectors array

Source data to write

$toFile string

filename to use

Returns
Type Description
bool success
methodpublicsetConnectorStrings( String $source_id, String $connector_strings, String $language = '' ) : void
static

setConnectorStrings This method outputs the language Strings for a given connector instance

Parameters
Name Type Description
$source_id String

String value of the connector id to write language strings for (e.g., ext_soap_marketo)

$connector_strings String

array value of the connector_strings

$language String

optional String value for the language to use (defaults to $GLOBALS['current_language'])

methodprivatesetDefaultHoverField( Array $viewdefs, String $module,  $source_id ) : boolean

setDefaultHoverField Sets the hover field to the first element in the detailview screen

Parameters
Name Type Description
$viewdefs Array

the metadata of the detailview

$module String

the Module to which the hover field should be added to

$source_id
Returns
Type Description
boolean True if field was added; false otherwise
methodpublicsetHoverField(  $viewdefs,  $module,  $hover_field,  $source_id ) : void

Parameters
Name Type Description
$viewdefs
$module
$hover_field
$source_id
methodpublicuninstallSource( String $source ) : boolean
static

uninstallSource

Parameters
Name Type Description
$source String

String value of the id of the connector to un-install

Returns
Type Description
boolean $result boolean value indicating whether or not connector was un-installed
methodpublicupdateMetaDataFiles( ) : \$result
static

updateMetaDataFiles This method updates the metadata files (detailviewdefs.php) according to the settings in display_config.php

Returns
Type Description
\$result boolean value indicating whether or not the method successfully completed.
Documentation was generated by DocBlox 0.18.1.