Feature #19113
closedEnable USER object to become USER_INT on the fly
0%
Description
Sometimes USER objects need to become USER_INT. The attached patch makes it possible.
USER object now can call a method of tslib_cObj to convert themselves from USER to USER_INT. Any existing output will be discarded and they will be called again as a USER_INT object. Here is code example:
if ($this->cObj->getUserObjType() == tslib_cObj::OT_USER) { $content = 'I am running as USER object now.'; if (!$this->conf['allowCaching']) { $this->cObj->convertToUSER_INT(); return ''; } } else { $content .= 'I am running as USER_INT right now'; }
Extension can (and should!) check if it is running as USER or USER_INT. Additionally extensions must have "includeLibs" just like any other USER_INT in their TS setup. But they must be declared as USER.
Patch and test extension are attached.
(issue imported from #M8985)
Files
Updated by Clemens Riccabona over 13 years ago
- Target version deleted (
-1)
I just stumbled over this, and although it is quite old I feel that I have to post: THIS IS GREAT! :-)
For future visitors:
Read the last diff and do not copy the code from the example 'cause function name and constant name changed with integration due to CGL I think:
$this->cObj->getUserObjectType()
and
tslib_cObj::OBJECTTYPE_USER
For me this works great as a switch in connection with pageRenderer
(usual USER_INT plugins can't add headercode (JS/CSS) through the new pagerenderer ATM).