Introduction

What does it do?

This extension contains a lot of code samples that are used throughout the TYPO3 Core Documentation. The goals are two-fold:

  1. Provide an easy way for users to gain access to these examples for their own use.
  2. Store all code examples and content elements in a central place, so that it is easier for documentation maintainers to reproduce the examples from the documentation, in particular when refreshing the screenshots.

The usage of these examples is not explained in this manual. It is explained in the relevant documentation.

Not all code examples from the Core Documentation will be moved here as it is a rather huge task. Whenever possible code samples are taken from the TYPO3 Core itself. Furthermore priority is given to those code samples that are related to screenshots.

Backend Module

The extension introduces a backend module with different pages that introduce one concept each:

Page Tree

The extension initializes a page tree with custom content elements that introduce further concepts. Currently it contains only one dummy page, but should in perspective contain all custom pages and content needed for the documentation and not provided by other official TYPO3 distributions like EXT:introduction or EXT:styleguide. The latter are not primarily used for documentation.

An export preset "Examples Export Preset" is included in the dataset to export the page tree repeatedly during the development of the distribution, i.e. when having added a new page or content element. Read the manual "Creating a new distribution" for more information on how to reliably export page trees.

Page Tree Examples

Content element example

Data processor examples

RTE Configuration

Extending TCA

Site set settings

Site set settings can be defined through a file like EXT:example/Configuration/Sets/Examples/settings.definitions.yaml.

Here is the auto-generated listing of all definitions. This is for example purposes only, and not yet implemented:

Name Type Label
Site settings examples
Examples
string Path to template root (FE)
string Path to template partials (FE)
string Path to template layouts (FE)
string Doktypes to exclude
string List of page uids which should be excluded recursive
string Additional where clause
Available types
int Type int
number Type number
bool Type bool
bool Type bool
string Type string
text Type text
string Type string with enum
stringlist Type stringlist
color Type text

Example

Example
Label
Site settings examples

Example.examples

Example.examples
Label
Examples

example.output.view.templateRootPath

example.output.view.templateRootPath
Type
string
Default
"EXT:example/Resources/Private/Templates/"
Label
Path to template root (FE)
Category
Site settings examples > Examples

example.output.view.partialRootPath

example.output.view.partialRootPath
Type
string
Default
"EXT:example/Resources/Private/Partials/"
Label
Path to template partials (FE)
Category
Site settings examples > Examples

example.output.view.layoutRootPath

example.output.view.layoutRootPath
Type
string
Default
"EXT:example/Resources/Private/Layouts/"
Label
Path to template layouts (FE)
Category
Site settings examples > Examples

example.output.pages.excludedDoktypes

example.output.pages.excludedDoktypes
Type
string
Default
"3, 4, 6, 7, 199, 254"
Label
Doktypes to exclude
Category
Site settings examples > Examples

example.output.pages.excludePagesRecursive

example.output.pages.excludePagesRecursive
Type
string
Label
List of page uids which should be excluded recursive
Category
Site settings examples > Examples

example.output.pages.additionalWhere

example.output.pages.additionalWhere
Type
string
Default
"{#no_index} = 0 AND {#canonical_link} = ''"
Label
Additional where clause
Category
Site settings examples > Examples

Example.types

Example.types
Label
Available types

example.types.int

example.types.int
Type
int
Default
42
Label
Type int
Category
Site settings examples > Available types

Checks whether the value is already an integer or can be interpreted as an integer. If yes, the string is converted into an integer.

example.types.number

example.types.number
Type
number
Default
3.16
Label
Type number
Category
Site settings examples > Available types

Checks whether the value is already an integer or float or whether the string can be interpreted as an integer or float. If yes, the string is converted to an integer or float.

example.types.bool

example.types.bool
Type
bool
Default
true
Label
Type bool
Category
Site settings examples > Available types

Casts the value to a boolean.

example.types.bool-false

example.types.bool-false
Type
bool
Default
false
Label
Type bool
Category
Site settings examples > Available types

Casts the value to a boolean.

example.types.string

example.types.string
Type
string
Default
"EXT:example/Resources/Private/Templates/"
Label
Type string
Category
Site settings examples > Available types

Converts almost all data types into a string. If an object has been specified, it must be stringable, otherwise no conversion takes place. Boolean values are converted to "true" and "false".

example.types.text

example.types.text
Type
text
Default
"EXT:example/Resources/Private/Templates/"
Label
Type text
Category
Site settings examples > Available types

Exactly the same as the `string` type. Use it as an alias if someone doesn't know what to do with `string`.

example.types.string-enum

example.types.string-enum
Type
string
Default
"summer"
Label
Type string with enum
Enum
{ "spring": "Spring time", "summer": "Seasons in the sun", "fall": "Wine harvest", "winter": "Cold" }
Category
Site settings examples > Available types

Site settings can provide possible options via the `enum` specifier, that will be selectable in the editor GUI.

example.types.stringlist

example.types.stringlist
Type
stringlist
Default
[ "Dog", "Cat", "Bird", "Spider" ]
Label
Type stringlist
Category
Site settings examples > Available types

The value must be an array whose array keys start at 0 and increase by 1 per element. The list in this type is derived from the internal PHP method array_is_list() and has nothing to do with the fact that comma-separated lists can also be converted here. The `string` type is executed for each array entry.

example.types.color

example.types.color
Type
color
Default
"#FF8700"
Label
Type text
Category
Site settings examples > Available types

Checks whether the specified string can be interpreted as a color code. Entries starting with `rgb`, `rgba` and `#` are permitted here. For `#` color codes, for example, the system checks whether they have 3, 6 or 8 digits.

Credits

Some of the examples were originally created by Kasper Skårhøj.