Documentation · ViewHelper reference


This ViewHelper renders CObjects from the global TypoScript configuration.


Render lib object

<f:cObject typoscriptObjectPath="lib.someLibObject" />


rendered lib.someLibObject

Specify cObject data & current value

<f:cObject typoscriptObjectPath="lib.customHeader" data="{article}" currentValueKey="title" />


rendered lib.customHeader. data and current value will be available in TypoScript

inline notation

{article -> f:cObject(typoscriptObjectPath: 'lib.customHeader')}


rendered lib.customHeader. data will be available in TypoScript

  • Tag usage example

    <f:cObject typoscriptObjectPath="foo" data="[mixed]" currentValueKey="NULL" table="''">
    	<!-- tag content - may be ignored! -->
  • Inline usage example

    {f:cObject(typoscriptObjectPath: 'foo', data: [mixed], currentValueKey: 'NULL', table: '''')}


Argument Description Type
currentValueKey string

the data to be used for rendering the cObject. Can be an object, array or string. If this argument is not set, child nodes will be used

table string

the TypoScript setup path of the TypoScript object to render

Required attribute

Revision history

commit 38ebcedd944471b83d9293b648264fd3e65634f1
Author: Bastian Waidelich <*****>
Date:   Tue May 5 20:52:33 2009 +0000

    * Changes backported from FLOW3:
      * major cleanup and refactoring of core and view helper classes & comments
      * added validation for boolean arguments in AbstractViewHelper
      * added initialize-method to AbstractViewHelper, that is called before render(). This was especially needed for tagbased viewhelpers.
      * renderChildren() now directly calls evaluateChildNodes() on the respective view helper node allowing us to render objects/arrays.
      * improved boolean type conversion for arguments in ViewHelperNode.
      * added TagBuilder class, re-wrote all tag based view helpers to use it (see form view helpers for some examples)
      * ViewHelperArguments collection got a new method "hasArgument()" that returns TRUE when the specified argument exists and is not NULL
    * tx_fluid changes:
      * Improved fake object factory. Now objects are injected to subclasses and implementations of the specified classes/interfaces.
      * cleaned up and tweaked view helpers. Removed Parsefunc, Stdwrap and TypoScript view helpers for now. Added CObject, If/Then/Else, EmailLink, Crop, Currency, Debug, HTML, Nl2br, Image view helpers. Thanks to Sebastian Böttger, Christopher Hlubek, Niels Pardon, Andreas Pattynama for the help!
    * Note: Unit tests not fully backported yet.

commit 6422d744a92e6d2b64f59ab45ba8ff3e3fadfcda
Author: Bastian Waidelich <*****>
Date:   Wed May 6 18:21:16 2009 +0000

    * removed obsolete compatibility classes and replaced references with the respective extbase classes
    * added ob_start() to debug view helper

commit 581c108652398b6301752d973636a930f4611a78
Author: Bastian Waidelich <*****>
Date:   Sat May 16 12:46:47 2009 +0000

    Fluid: (Backported from Fluid Package r2213 - r2230):
     * AbstractViewHelper: there is no default data type of "Text" set anymore for method parameters to be able to throw a meaningful exception if method argument annotations could not be parsed (e.g. due to PHP optimizers that stripped off the docComments). This relates to #3309.
     * Started to refactor unit tests in order to reduce dependencies. This relates to #3311.
     * Replaced public properties by setter methods in core classes.
     * NOTE: this version requires the latest extbase version as it relies on the extbase autoloader.

commit 50af6b9c08d04e3e1d4ce56a499a9a3d4b84efc3
Author: Sebastian Kurfürst <*****>
Date:   Thu May 28 21:45:46 2009 +0000

    * Backported major changes from Fluid v5 to Fluid v4
    * !!! Many of these changes are not backwards-compatible! Please read this if you have written custom ViewHelpers!
    * Introduced Shorthand Syntax for calling ViewHelpers
    * Core:
    ** Lots of internal cleanup and refactorings.
    ** !!! Complete restructuring into subpackages.
    * ViewHelpers:
    ** !!! The base classes of ViewHelpers changed to Tx_Fluid_Core_ViewHelper_AbstractViewHelper and Tx_Fluid_Core_ViewHelper_TagBasedViewHelper. Please adjust your ViewHelpers!
    ** !!! $this->variableContainer has been renamed to $this->templateVariableContainer
    ** !!! the view is not in $this->variableContainer anymore. Currently there is no way to fetch the View from a ViewHelper.
    ** Introduced a new $this->controllerContext containing the context variables of the controller
    ** !!! The request can be now found in $this->controllerContext->getRequest()
    ** !!! The URIHelper has been renamed to URIBuilder and can be now found in $this->controllerContext->getURIBuilder()
    ** Introduced a new ViewHelperVariableContainer, available in $this->viewHelperVariableContainer to pass data between ViewHelpers. Should only be needed in very rare cases.
    ** !!! Removed <f:format.htmlEscape> ViewHelper! Please remove these declarations in your template! Escaping of object accessors is now automatically done, see next point.
    * !!! ObjectAccessors {...} are now automatically HTMLspecialChar'd if not used as an argument to a ViewHelper. This is done using a new ObjectAccessorPostProcessor. Lateron, this will be made configurable.

commit 3197b416216c8888cfa4eab9aae67d4b89e74726
Author: Bastian Waidelich <*****>
Date:   Sun Aug 9 19:41:01 2009 +0000

    [~BUGFIX] Fluid (ViewHelpers): Replaced usage of $GLOBALS['TSFE']->cObj by t3lib_div::makeInstance('tslib_cObj') in CObjectViewHelper, HtmlViewHelper and ImageViewHelper. Note: In CropViewHelper & EmailViewHelper it does no harm to use $GLOBALS['TSFE']->cObj. Thanks for the patch. Resolves #4063.

commit a737739af5637ab6b5a19cfd7eb41d646b4c020c
Author: Bastian Waidelich <*****>
Date:   Thu Sep 17 12:44:23 2009 +0000

    [+FEATURE] Fluid (Viewhelpers): Added backend mode support for view helpers base, cObject, format.crop (partly),, translate (partly), Now only image- and renderFlashMessages view helpers are not working in BE

commit 71eb52f289bd61c2ec12dd8a86007cfe92b755a2
Author: Bastian Waidelich <*****>
Date:   Thu Oct 29 11:20:10 2009 +0000

    [+FEATURE] Fluid (ViewHelpers): extended cObject viewhelper by an additional "data" argument. Now you can write {f:cObject(typoscriptObjectPath: 'lib.someCObject', data: someObject)} in your templates. This change is backwards compatible! Relates to #5150
    [+FEATURE] Fluid (ViewHelpers): extended translate viewhelper by an additional "default" argument. Now you can write {f:translate(key: 'someLocallangKey', default: 'some fallback')} in your templates. This change is backwards compatible! Relates to #5150

commit 186bdaeac89820779f91853b830cc95d60c7ad58
Author: Bastian Waidelich <*****>
Date:   Tue Jul 13 09:42:26 2010 +0000

    [-TASK] Fluid: R*****@version annotation from all Fluid classes to ease the backporting process. Relates to #8835 (backported from Fluid package)

commit 1d36de6ed90007e324b773782e8f0a1d1c1191a2
Author: Bastian Waidelich <*****>
Date:   Tue Jul 13 10:12:30 2010 +0000

    [-TASK] Fluid: R*****@package/@subpackage annotations from all Fluid classes. They have already been removed in FLOW3 packages in r2813.

commit 7c4adb435f5739a8574b3c28d79993ec1cae4270
Author: Bastian Waidelich <*****>
Date:   Mon Jul 19 18:09:46 2010 +0000

    [~TASK] Fluid (ViewHelpers): Fixed BE support of the ViewHelpers cObject, format.crop, uri.resource. Relates to #8947
    [~TASK] Fluid (ViewHelpers): Added BE support in the ViewHelpers format.html and image. Relates to #8947

commit d172402d2970e315aab456b74402e923f63305af
Author: Bastian Waidelich <*****>
Date:   Tue Oct 26 14:27:46 2010 +0000

    [+TASK] Fluid (ViewHelpers): Minor tweak in CObject ViewHelper
    Make sure, that the configurationManager is initialized.
    This is just a preliminary solution that will be replaced as soon
    as the Extbase dispatcher refactoring (#7153) is done.

commit 5c8c4d6012158d52bf1618cb25ef066d9f639f31
Author: Bastian Waidelich <*****>
Date:   Sun Nov 14 13:38:48 2010 +0000

    [+FEATURE] Fluid (Core/Widget): Added Tx_Fluid_Core_Widget_Bootstrap that is used to dispatch Ajax requests (see ext_typoscript_setup.txt).
    [~TASK] Fluid (Compatibility): Removed Tx_Fluid_Compatibility_ObjectManager and replaced instances by Tx_Extbase_Object_ObjectManagerInterface instances
    [~TASK] Fluid (Core/Widget): AbstractWidgetController has to be a singleton so it can be injected in the WidgetViewHelper.. To be discussed!
    [+TASK] Fluid (Core/Widget): AjaxWidgetContextHolder is now correctly stored in the BE/FE Users session if the ajaxWidget of the corresponding Widget is TRUE.
    [+TASK] Fluid (Core/Widget): The WidgetContext now contains a reference to the parent extension & plugin name. That's needed for the widgetAjaxResponse.
    [+BUGFIX] Fluid (Core/Widget): WidgetRequestBuilder now correctly interprets GET parameters and dispatches Ajax requests
    [+BUGFIX] Fluid (ViewHelpers): Modified ViewHelpers cObject, format.crop, format.html, image, uri.image so that they use dependency injection in order to retrieve the current cObject instance from the configurationManager
    [+BUGFIX] Fluid (ViewHelpers): Fixed form ViewHelper to respect configured pluginNamespace in field name prefixes
    [+BUGFIX] Fluid (ViewHelpers): link.widget/uri.widget ViewHelpers now create correct URIs
    [+BUGFIX] Fluid (ViewHelpers):*****@inject annotation by injectController method in AutocompleteViewHelper.

commit 4c2388a2d4d778a5259b3131b8b13cc389d741f4
Author: Bastian Waidelich <*****>
Date:   Wed Nov 17 08:19:29 2010 +0000

    [+FEATURE] Fluid (ViewHelpers): the subject argument of the count ViewHelper is now optional so you can use it like {objects -> f:count()}
    [+BUGFIX] Fluid (ViewHelpers): Fixed inline documentation of widget.autocomplete ViewHelper. This fixes #10882
    [+TASK] Fluid (ViewHelpers): Added some more inline documentation for cObject, widget.paginate, widget.autocomplete & count ViewHelpers

commit 24cb9c614df512f709097c0a0df28becd9b16ea9
Author: Claus Due <*****>
Date:   Mon May 16 22:15:38 2011 +0200

    [+BUGFIX] Fluid: CObjViewHelper fix deprecated call "getAccessibleProperties"
    This simply changes the call to to use new method
    Change-Id: I98184e96f76714835f02197d118681fdb85d5509
    Fixes: #26138

commit e25c7d562da2779bd5dc0d8a873f55d17446afb5
Author: Claus Due <*****>
Date:   Mon May 16 23:51:43 2011 +0200

    [+BUGFIX] CObjViewHelper: fixed using numeric values as data argument
    Added a simple extra condition is_numeric() to treat numeric
    values the same as string values.
    Change-Id: I805fcb37ff17b879d37e9e9e5c657552d4335afd
    Fixes: #12891

commit 89a0c831a09d40fdd76555a79782071d267c34a2
Author: Sebastian Kurfuerst <*****>
Date:   Sun Jun 19 13:39:25 2011 +0200

    [+BUGFIX] Fluid: Fix CObjViewHelper
    In I98184e96f76714835f02197d118681fdb85d5509 an error has been
    introduced: instead of getGettablePropertyNames, getGettableProperties
    should be called.
    Change-Id: I5034bc9391ee1b43fe9b4db12f00a926e0cf3fa5
    Fixes: #26138

commit d52fbe2b75d0c292e8893abd612e15637e63cd6a
Author: Bastian Waidelich <*****>
Date:   Tue Aug 2 11:04:30 2011 +0200

    [BUGFIX] disable escape interceptor for cObject ViewHelper
    Change-Id: Ic45a4d3c1937169eb0ec010ab1ea5753c0d450e7

commit 65528aa9019d0c77ec748984094068cbf64b7a89
Author: Bastian Waidelich <*****>
Date:   Fri Sep 9 20:41:05 2011 +0200

    [BUGFIX] Create new CObject in CObject ViewHelper
    Previously CObject ViewHelper used the Content Object
    of the Plugin. Sharing the same instance has some side
    effects though (see #12332).
    With this change the CObject ViewHelper new creates
    a fresh tslib_cObj instance.
    Change-Id: Ie1265b86641d86d31d6a37ec9fb84949809ca6c5
    Resolves: #12332

commit fd09d197fa8886b97cb20aa9573f39cd08ce989e
Author: Bastian Waidelich <*****>
Date:   Thu Nov 10 18:27:58 2011 +0100

    [TASK] S*****@author annotations
    This backports three recent changes of the TYPO3.Fluid package:
    - R*****@license annotation from files (290f4f5)
    - Simplify license header in PHP files (14bacba)
    - D*****@author tags from source code (9c2e837)
    This should not contain any functional change!
    Change-Id: I9376dca4af78c4f0f82413011d115b8ad04634dd

commit ca40f8a066da4ea3c849d74f68a9bc73758976c5
Author: dkd-egerer Sascha Egerer <*****>
Date:   Sat Apr 14 21:43:10 2012 +0200

    [TASK] Remove trailing whitespace
    There must be no empty lines after the closing
    PHP tag. Empty lines after closing tags break
    output compression in PHP and/or result in AJAX
    Change-Id: I0484ca29d8134d0828cf30880d5aafd43ed9d78e
    Resolves: #36076
    Releases: 6.0
    Reviewed-by: Ingo Pfennigstorf
    Tested-by: Ingo Pfennigstorf
    Reviewed-by: Daniel Lorenz
    Tested-by: Daniel Lorenz
    Reviewed-by: Christian Kuhn
    Tested-by: Christian Kuhn

commit ec3891d8d4e339d8319428211207e6201be9fd73
Author: Thomas Maroschik <*****>
Date:   Wed Oct 17 21:18:26 2012 +0200

    [TASK][WIP] Move non class code back to source files
    Change-Id: I620d2e61860142cdc89cc83474c95542799961c0

commit 554e8f890dcc0dd86a27518b58e2b54be26fd37e
Author: Thomas Maroschik <*****>
Date:   Wed Oct 17 22:20:17 2012 +0200

    [TASK] Namespace classes
    Change-Id: Ia7432e1c923826ed58206bca15fb94509adbd508

commit 547ef7f60f39c6bfcb0376e5e76070da85860098
Author: Arvid Jakobsson <*****>
Date:   Mon Sep 17 21:25:51 2012 +0200

    [TASK] Remove superfluous parenthesis in sysexts
    Superfluous brackets in fluid after namespaces move
    Change ("a" . "b") . "c" into "a" . "b" . "c" using the lex-pass tool.
    Resolves: #41016
    Related: #40095
    Releases: 6.0
    Change-Id: I64741473cb24eda343f0576ebd1a0f1846dfc3f8
    Reviewed-by: Oliver Hader
    Tested-by: Oliver Hader

commit 9d46e6932d35c79bf87c96fa38b8e537c4192f23
Author: Alexander Schnitzler <*****>
Date:   Tue Nov 20 16:27:02 2012 +0100

    [CLEANUP] Adjust code to CGL and fix small namespace bugs
    * whitespaces, tabs and blank line issues
    * bool -> boolean
    * int -> integer
    * fix wrong namespace annotations
    Fixes: #43157
    Releases: 6.0
    Change-Id: I8397948e19248db029d8efd1555ee56e4982742d
    Reviewed-by: Helmut Hummel
    Tested-by: Helmut Hummel

commit fae04a024687fd061c41d67076cfb455d189aefc
Author: Christian Kuhn <*****>
Date:   Wed May 1 17:57:52 2013 +0200

    [BUGFIX] Mentions of old class names
    Change-Id: Iee7a863a9d68d1379e1e616414b9848e0c535a8a
    Resolves: #47791
    Releases: 6.2
    Reviewed-by: Christian Kuhn
    Tested-by: Christian Kuhn

commit 77f29a3c69a7cbb27b34072754aa503bace6c9f1
Author: Christian Kuhn <*****>
Date:   Tue Oct 1 14:40:56 2013 +0200

    [TASK] Remove closing PHP tags
    Change-Id: Iaa92566c53301e49396fc9fb26b0b339c48d567b
    Resolves: #52360
    Releases: 6.2
    Reviewed-by: Christian Kuhn
    Tested-by: Christian Kuhn
    Reviewed-by: Ernesto Baschny
    Tested-by: Ernesto Baschny
    Reviewed-by: Anja Leichsenring
    Tested-by: Anja Leichsenring

commit 86c8f8076b22d2c8a02f1ddaee5fa798e49cf710
Author: Wouter Wolters <*****>
Date:   Sun May 12 22:17:27 2013 +0200

    [BUGFIX] Add table as parameter to CObjectViewHelper
    When passing a tt_content record with an image to the
    CObjectViewHelper it doesn't convert the FAL reference with
    an image path. To correct this we add an optional parameter
    for the table.
    Change-Id: I7d045e4e785cf99410ca359eb1011a59ac5cb0fe
    Resolves: #47368
    Releases: 6.2, 6.1, 6.0
    Reviewed-by: Anja Leichsenring
    Tested-by: Anja Leichsenring
    Reviewed-by: Helmut Hummel
    Reviewed-by: Christian Kuhn
    Tested-by: Christian Kuhn

commit d47f9cf9b010cbdcc1d55cbbc9312efa7e6e5ba9
Author: Roland Waldner <*****>
Date:   Sat May 3 16:30:46 2014 +0200

    [TASK] A*****@var for calls to makeInstance()
    Resolves: #58459
    Related: #50248
    Releases: 6.2
    Change-Id: I3b72ecd65dff934a4eff10be7cb3c46ded948a34
    Reviewed-by: Christian Kuhn
    Tested-by: Christian Kuhn