TYPO3
7.6
|
Public Member Functions | |
init () | |
menuConfig () | |
mergeExternalItems ($modName, $menuKey, $menuArr) | |
handleExternalFunctionValue ($MM_key= 'function', $MS_value=null) | |
getExternalItemConfig ($modName, $menuKey, $value= '') | |
checkExtObj () | |
checkSubExtObj () | |
extObjHeader () | |
extObjContent () | |
Public Attributes | |
$MCONF = array() | |
$id | |
$CMD | |
$perms_clause | |
$MOD_MENU | |
$MOD_SETTINGS = array() | |
$modTSconfig | |
$modMenu_type = '' | |
$modMenu_dontValidateList = '' | |
$modMenu_setDefaultList = '' | |
$extClassConf | |
$content = '' | |
$doc | |
$extObj | |
Protected Member Functions | |
getLanguageService () | |
getBackendUser () | |
getDatabaseConnection () | |
getPageRenderer () | |
Protected Attributes | |
$pageRenderer = null | |
Parent class for 'ScriptClasses' in backend modules.
EXAMPLE PROTOTYPE
As for examples there are lots of them if you search for classes which extends However you can see a prototype example of how a module might use this class in an index.php file typically hosting a backend module.
NOTICE: This example only outlines the basic structure of how this class is used. You should consult the documentation and other real-world examples for some actual things to do when building modules.
TYPICAL SETUP OF A BACKEND MODULE:
PrototypeController EXTENDS THE CLASS with a main() and printContent() function:
namespace Vendor;
class PrototypeController extends { public function __construct() { $this->getLanguageService()->includeLLFile('EXT:prototype/Resources/Private/Language/locallang.xlf'); $this->getBackendUser()->modAccess($GLOBALS['MCONF'], TRUE); } }
MAIN FUNCTION - HERE YOU CREATE THE MODULE CONTENT IN $this->content public function main() { TYPICALLY THE INTERNAL VAR, $this->doc is instantiated like this: $this->doc = ::makeInstance(::class); TYPICALLY THE INTERNAL VAR, $this->backPath is set like this: $this->backPath = $this->doc->backPath = $GLOBALS['BACK_PATH']; ... AND OF COURSE A LOT OF OTHER THINGS GOES ON - LIKE PUTTING CONTENT INTO $this->content $this->content=''; } PRINT CONTENT - DONE AS THE LAST THING public function printContent() { echo $this->content; }
MAKE INSTANCE OF THE SCRIPT CLASS AND CALL init() $GLOBALS['SOBE'] = ::makeInstance(::class); $GLOBALS['SOBE']->init();
THEN WE WILL CHECK IF THERE IS A 'SUBMODULE' REGISTERED TO BE INITIALIZED AS WELL: $GLOBALS['SOBE']->checkExtObj();
THEN WE CALL THE main() METHOD AND THIS SHOULD SPARK THE CREATION OF THE MODULE OUTPUT. $GLOBALS['SOBE']->main(); FINALLY THE printContent() FUNCTION WILL OUTPUT THE ACCUMULATED CONTENT $GLOBALS['SOBE']->printContent();
Definition at line 76 of file BaseScriptClass.php.
checkExtObj | ( | ) |
Creates an instance of the class found in $this->extClassConf['name'] in $this->extObj if any (this should hold three keys, "name", "path" and "title" if a "Function menu module" tries to connect...) This value in extClassConf might be set by an extension (in an ext_tables/ext_localconf file) which thus "connects" to a module. The array $this->extClassConf is set in handleExternalFunctionValue() based on the value of MOD_SETTINGS[function] If an instance is created it is initiated with $this passed as value and $this->extClassConf as second argument. Further the $this->MOD_SETTING is cleaned up again after calling the init function.
Definition at line 298 of file BaseScriptClass.php.
References GeneralUtility\_GP(), BackendUtility\getModuleData(), and GeneralUtility\makeInstance().
Referenced by PageFunctionsController\mainAction(), InfoModuleController\mainAction(), and TypoScriptTemplateModuleController\mainAction().
checkSubExtObj | ( | ) |
Calls the checkExtObj function in sub module if present.
Definition at line 313 of file BaseScriptClass.php.
Referenced by PageFunctionsController\mainAction(), and InfoModuleController\mainAction().
extObjContent | ( | ) |
Calls the 'main' function inside the "Function menu module" if present
Definition at line 340 of file BaseScriptClass.php.
References AbstractMessage\ERROR, BaseScriptClass\getLanguageService(), and GeneralUtility\makeInstance().
Referenced by InfoModuleController\main(), and PageFunctionsController\main().
extObjHeader | ( | ) |
Calls the 'header' function inside the "Function menu module" if present. A header function might be needed to add JavaScript or other stuff in the head. This can't be done in the main function because the head is already written. example call in the header function: $this->pObj->doc->JScode = $this->pObj->doc->wrapScriptTags(' ...
Definition at line 328 of file BaseScriptClass.php.
|
protected |
Returns the Backend User
Definition at line 371 of file BaseScriptClass.php.
References $GLOBALS.
Referenced by TypoScriptTemplateModuleController\init(), BaseScriptClass\init(), and BaseScriptClass\mergeExternalItems().
|
protected |
getExternalItemConfig | ( | $modName, | |
$menuKey, | |||
$value = '' |
|||
) |
Returns configuration values from the global variable $TBE_MODULES_EXT for the module given. For example if the module is named "web_info" and the "function" key ($menuKey) of MOD_SETTINGS is "stat" ($value) then you will have the values of $TBE_MODULES_EXT['webinfo']['MOD_MENU']['function']['stat'] returned.
string | $modName | Module name |
string | $menuKey | Menu key, eg. "function" for the function menu. See $this->MOD_MENU |
string | $value | Optionally the value-key to fetch from the array that would otherwise have been returned if this value was not set. Look source... |
Definition at line 281 of file BaseScriptClass.php.
References $GLOBALS.
Referenced by BaseScriptClass\handleExternalFunctionValue().
|
protected |
Returns the Language Service
Definition at line 362 of file BaseScriptClass.php.
References $GLOBALS.
Referenced by DatabaseIntegrityView\__construct(), SchedulerModuleController\__construct(), TypoScriptTemplateModuleController\__construct(), SchedulerModuleController\deleteTask(), SchedulerModuleController\executeTasks(), BaseScriptClass\extObjContent(), DatabaseIntegrityView\func_search(), TypoScriptTemplateModuleController\getButtons(), SchedulerModuleController\getButtons(), SchedulerModuleController\getModuleContent(), SchedulerModuleController\getRegisteredClasses(), SchedulerModuleController\getTemplateMarkers(), SchedulerModuleController\main(), DatabaseIntegrityView\menuConfig(), SchedulerModuleController\menuConfig(), BaseScriptClass\mergeExternalItems(), SchedulerModuleController\renderTaskProgressBar(), and SchedulerModuleController\stopTask().
|
protected |
Definition at line 387 of file BaseScriptClass.php.
References BaseScriptClass\$pageRenderer, and GeneralUtility\makeInstance().
Referenced by DatabaseIntegrityView\func_search(), and TaskModuleController\renderListMenu().
handleExternalFunctionValue | ( | $MM_key = 'function' , |
|
$MS_value = null |
|||
) |
Loads $this->extClassConf with the configuration for the CURRENT function of the menu.
string | $MM_key | The key to MOD_MENU for which to fetch configuration. 'function' is default since it is first and foremost used to get information per "extension object" (I think that is what its called) |
string | $MS_value | The value-key to fetch from the config array. If NULL (default) MOD_SETTINGS[$MM_key] will be used. This is useful if you want to force another function than the one defined in MOD_SETTINGS[function]. Call this in init() function of your Script Class: handleExternalFunctionValue('function', $forcedSubModKey) |
Definition at line 263 of file BaseScriptClass.php.
References BaseScriptClass\getExternalItemConfig().
Referenced by BaseScriptClass\init().
init | ( | ) |
Initializes the backend module by setting internal variables, initializing the menu.
Definition at line 202 of file BaseScriptClass.php.
References $GLOBALS, GeneralUtility\_GP(), BaseScriptClass\getBackendUser(), BaseScriptClass\handleExternalFunctionValue(), and BaseScriptClass\menuConfig().
Referenced by PageFunctionsController\mainAction(), InfoModuleController\mainAction(), and VersionModuleController\mainAction().
menuConfig | ( | ) |
Initializes the internal MOD_MENU array setting and unsetting items based on various conditions. It also merges in external menu items from the global array TBE_MODULES_EXT (see mergeExternalItems()) Then MOD_SETTINGS array is cleaned up (see ::getModuleData()) so it contains only valid values. It's also updated with any SET[] values submitted. Also loads the modTSconfig internal variable.
Definition at line 223 of file BaseScriptClass.php.
References GeneralUtility\_GP(), BackendUtility\getModTSconfig(), BackendUtility\getModuleData(), BaseScriptClass\mergeExternalItems(), and BackendUtility\unsetMenuItems().
Referenced by BaseScriptClass\init().
mergeExternalItems | ( | $modName, | |
$menuKey, | |||
$menuArr | |||
) |
Merges menu items from global array $TBE_MODULES_EXT
string | $modName | Module name for which to find value |
string | $menuKey | Menu key, eg. 'function' for the function menu. |
array | $menuArr | The part of a MOD_MENU array to work on. |
Definition at line 242 of file BaseScriptClass.php.
References $GLOBALS, BaseScriptClass\getBackendUser(), BaseScriptClass\getLanguageService(), and GeneralUtility\inList().
Referenced by TaskModuleController\menuConfig(), and BaseScriptClass\menuConfig().
$CMD |
Definition at line 100 of file BaseScriptClass.php.
$content = '' |
Definition at line 176 of file BaseScriptClass.php.
Referenced by TaskModuleController\description(), SchedulerModuleController\getModuleContent(), TaskModuleController\indexAction(), TaskModuleController\openInNewWindow(), InfoModuleController\printContent(), TaskModuleController\printContent(), ImportExportController\printContent(), PageFunctionsController\printContent(), DatabaseIntegrityView\printContent(), ConfigurationView\printContent(), TypoScriptTemplateModuleController\printContent(), SchedulerModuleController\render(), TaskModuleController\renderInformationContent(), TaskModuleController\renderListMenu(), and TaskModuleController\renderModuleContent().
$doc |
Definition at line 181 of file BaseScriptClass.php.
$extClassConf |
Definition at line 169 of file BaseScriptClass.php.
$extObj |
Definition at line 189 of file BaseScriptClass.php.
$id |
Definition at line 92 of file BaseScriptClass.php.
Referenced by TaskModuleController\renderListMenu().
$MCONF = array() |
Definition at line 84 of file BaseScriptClass.php.
$MOD_MENU |
Definition at line 116 of file BaseScriptClass.php.
$MOD_SETTINGS = array() |
Definition at line 126 of file BaseScriptClass.php.
$modMenu_dontValidateList = '' |
Definition at line 152 of file BaseScriptClass.php.
$modMenu_setDefaultList = '' |
Definition at line 161 of file BaseScriptClass.php.
$modMenu_type = '' |
Definition at line 143 of file BaseScriptClass.php.
$modTSconfig |
Definition at line 134 of file BaseScriptClass.php.
|
protected |
Definition at line 194 of file BaseScriptClass.php.
Referenced by SchedulerModuleController\__construct(), and BaseScriptClass\getPageRenderer().
$perms_clause |
Definition at line 108 of file BaseScriptClass.php.