.. include:: /Includes.rst.txt
.. _cb_extendTyposcript:

=================
Extend TypoScript
=================

Content Blocks generate a `FLUIDTEMPLATE` :ref:`TypoScript <t3tsref:cobj-template>`
object for each Content Element. This TypoScript can be extended or overridden
as needed.

How to extend or override Content Blocks TypoScript
===================================================

The basis for each Content Element
----------------------------------

Every Content Element which is generated by Content Blocks inherits this
TypoScript:

.. code-block:: typoscript

    lib.contentBlock = FLUIDTEMPLATE
    lib.contentBlock {
        dataProcessing {
            10 = content-blocks
        }
    }

Finding the right TypoScript object
-----------------------------------

In the TypoScript backend module in the submodule "Active TypoScript", formerly
known as "TypoScript Object Browser", the Content Elements created by Content
Blocks can be found as usual in the section `tt_content`.

The name corresponds to the :confval:`typeName <content-element-typename>`
defined in config.yaml.

Example:

.. code-block:: typoscript

    tt_content {
        myvendor_mycontentblockname {
            file = EXT:site_package/ContentBlocks/ContentElements/content-element-name/templates/frontend.html
            layoutRootPaths {
                20 = EXT:site_package/ContentBlocks/ContentElements/content-element-name/templates/layouts/
            }
            partialRootPaths {
                20 = EXT:site_package/ContentBlocks/ContentElements/content-element-name/templates/partials/
            }
        }
    }

This TypoScript object has all the properties that :ref:`FLUIDTEMPLATE <t3tsref:cobj-fluidtemplate-properties>`
offers.

Extend every Content Block
--------------------------

.. code-block:: typoscript
   :caption: EXT:site_package/Configuration/TypoScript/setup.typoscript

    lib.contentBlock {
        settings {
            defaultHeaderType = {$styles.content.defaultHeaderType}
        }
        variables {
            demo = TEXT
            demo {
                value = some text
            }
        }
        dataProcessing {
            200 = menu
            200 {
              special = rootline
              as = breadcrumb
            }
        }
    }

Extending a specific Content Block
----------------------------------

.. code-block:: typoscript
   :caption: EXT:site_package/Configuration/TypoScript/setup.typoscript

    tt_content.myvendor_mycontentblockname {
        settings {
            defaultHeaderType = {$styles.content.defaultHeaderType}
        }
        variables {
            demo = TEXT
            demo {
                value = some text
            }
        }
        dataProcessing {
            200 = menu
            200 {
              special = rootline
              as = breadcrumb
            }
        }
    }

See also:

*  :ref:`Shared Partials <cb_extension_partials>`
*  :ref:`Fluid Styled Content integration <fsc-guide>`
