Initial commit - Typo3 11.5.41
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
.. include:: /Includes.rst.txt
|
||||
|
||||
|
||||
.. _tutorial-displaymode:
|
||||
|
||||
Create custom display mode
|
||||
==========================
|
||||
The setting **Display Mode** can be found in the tab "Display". It can be used to change the template depending
|
||||
on the selection.
|
||||
|
||||
.. image:: ../../Images/tutorial-displaymode.png
|
||||
|
||||
|
||||
Add a new value
|
||||
---------------
|
||||
Add the following code to your `Page TsConfig`, either in the field *TsConfig* in the page properties or better to your site package extension.
|
||||
|
||||
.. code-block:: typoscript
|
||||
|
||||
TCEFORM {
|
||||
tt_content {
|
||||
pi_flexform {
|
||||
ttaddress_listview {
|
||||
sDISPLAY {
|
||||
settings\.displayMode.addItems {
|
||||
map = Map View
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Now a new option **Map View** is available with the value `map`.
|
||||
|
||||
Adopt templates
|
||||
---------------
|
||||
If a displaymode is selected, this can be checked in the template with `{settings.displayMode}`.
|
||||
19
typo3conf/ext/tt_address/Documentation/Tutorials/Index.rst
Normal file
19
typo3conf/ext/tt_address/Documentation/Tutorials/Index.rst
Normal file
@@ -0,0 +1,19 @@
|
||||
.. include:: /Includes.rst.txt
|
||||
|
||||
|
||||
.. _tutorials:
|
||||
|
||||
Tutorials
|
||||
=========
|
||||
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
:titlesonly:
|
||||
|
||||
Templates/Index
|
||||
Linkhandler
|
||||
RichSnippets/Index
|
||||
CustomDisplayMode/Index
|
||||
OverrideDemand/Index
|
||||
UsageOfAddressRepository/Index
|
||||
@@ -0,0 +1,65 @@
|
||||
.. include:: /Includes.rst.txt
|
||||
.. _linkhandler:
|
||||
|
||||
===========
|
||||
LinkHandler
|
||||
===========
|
||||
|
||||
The LinkHandler can be configured to create links to the detail view of
|
||||
tt_address records. If configured editing users can use the
|
||||
:ref:`LinkBrowser <t3coreapi:LinkBrowser>` in the rich-text-editor and link
|
||||
fields to link to the detail page of any address record.
|
||||
|
||||
Configuration for the backend
|
||||
=============================
|
||||
|
||||
:ref:`Page TSconfig <t3tsconfig:pagetsconfig>` is used to configure the link
|
||||
browser in the backend. See
|
||||
:ref:`Setting page TSconfig <t3tsconfig:setting-page-tsconfig>`.
|
||||
|
||||
For all available options see :ref:`t3coreapi:linkhandler-pagetsconfig`.
|
||||
|
||||
.. code-block:: typoscript
|
||||
:caption: EXT:my_sitepackage/Configuration/page.tsconfig
|
||||
|
||||
TCEMAIN.linkHandler {
|
||||
# my_address is an identifier, do not change it after links have been created
|
||||
my_address {
|
||||
handler = TYPO3\CMS\Recordlist\LinkHandler\RecordLinkHandler
|
||||
label = Contact
|
||||
configuration {
|
||||
table = tt_address
|
||||
# This storage pid is pre-selected by default
|
||||
storagePid = 42
|
||||
# Only these folders and their subfolders are displayed in the pagetree
|
||||
pageTreeMountPoints = 42, 43, 88
|
||||
hidePageTree = 0
|
||||
}
|
||||
scanAfter = page
|
||||
displayBefore = file
|
||||
}
|
||||
}
|
||||
|
||||
Configuration for the frontend
|
||||
==============================
|
||||
|
||||
The links are now stored in the database with the syntax
|
||||
:html:`<a href="t3://record?identifier=tt_address&uid=456">A link</a>`.
|
||||
By using TypoScript, these pseudo link is transformed into an actual link.
|
||||
|
||||
See :ref:`t3coreapi:linkhandler`.
|
||||
|
||||
.. code-block:: typoscript
|
||||
:caption: EXT:my_sitepackage/Configuration/TypoScript/setup.typoscript
|
||||
|
||||
config.recordLinks {
|
||||
# Use the same identifier as was used in :typoscript:`TCEMAIN.linkHandler`
|
||||
my_address {
|
||||
typolink {
|
||||
# Detail page uid
|
||||
parameter = 192
|
||||
additionalParams.data = field:uid
|
||||
additionalParams.wrap = &tx_ttaddress_listview[action]=show&tx_ttaddress_listview[address]=|&tx_ttaddress_listview[controller]=Address
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
.. include:: /Includes.rst.txt
|
||||
|
||||
|
||||
.. _tutorial-overrideDemand:
|
||||
|
||||
Override demand object
|
||||
======================
|
||||
It is possible to override the flexform configuration by providing additional GET arguments.
|
||||
|
||||
.. important::
|
||||
|
||||
This feature needs to be enabled per plugin with the checkbox *Allow override configuration by GET/POST*.
|
||||
|
||||
The following properties are allowed:
|
||||
|
||||
- `categories`: List of category ids
|
||||
- `categoryCombination`: Either the value `or` or `and`
|
||||
- `includeSubCategories`: Either 0 or 1
|
||||
- `sortOrder`: Either the value `asc` or `desc`
|
||||
|
||||
Example
|
||||
-------
|
||||
|
||||
The following example will create a link which filters the result by the category with uid `1`.
|
||||
|
||||
.. code-block:: html
|
||||
|
||||
<f:link.page
|
||||
additionalParams="{tx_ttaddress_listview:{override:{categories: 1}}}">
|
||||
Category 1
|
||||
</f:link.page>
|
||||
@@ -0,0 +1,20 @@
|
||||
.. include:: /Includes.rst.txt
|
||||
|
||||
|
||||
.. _tutorial-rich_snippets:
|
||||
|
||||
Rich snippets
|
||||
=============
|
||||
When you use structured data to mark up content, you help
|
||||
Google better understand its context for display in Search, and you achieve better distribution of your content to
|
||||
users from Search. (quote by google)
|
||||
|
||||
The full article can be found at https://developers.google.com/search/docs/guides/mark-up-content
|
||||
|
||||
The extension `tt_address` follows the guidelines and adds the proper information to every output of a field.
|
||||
|
||||
Testing
|
||||
-------
|
||||
If the templates are modified it is important to test if the markup is still valid regarding the rich snippets.
|
||||
|
||||
Google provides an online tool at https://search.google.com/structured-data/testing-tool/u/0/ which can be used for that.
|
||||
@@ -0,0 +1,44 @@
|
||||
.. include:: /Includes.rst.txt
|
||||
|
||||
|
||||
Group address records
|
||||
---------------------
|
||||
|
||||
.. tip::
|
||||
This is a feature delivered by fluid, so you can use it also in other extensions and projects.
|
||||
|
||||
|
||||
The following example will group all given address records by the property "firstCategory".
|
||||
|
||||
.. code-block:: html
|
||||
|
||||
<f:if condition="{addresses}">
|
||||
<f:then>
|
||||
<div style="border:1px solid red">
|
||||
<f:groupedFor each="{addresses}" as="groupedAddresses" groupBy="firstCategory" groupKey="category">
|
||||
<div style="border:1px solid blue;padding:10px;margin:10px;">
|
||||
<h1>{category.title}</h1>
|
||||
<f:for each="{groupedAddresses}" as="address">
|
||||
<div style="border:1px solid pink;padding:5px;margin:5px;">
|
||||
{address.firstName} {address.lastName}
|
||||
</div>
|
||||
</f:for>
|
||||
</div>
|
||||
</f:groupedFor>
|
||||
</div>
|
||||
</f:then>
|
||||
<f:else>
|
||||
<div class="no-addresses-found">
|
||||
No addresses found.
|
||||
</div>
|
||||
</f:else>
|
||||
</f:if>
|
||||
|
||||
|
||||
Keep an eye on performance!
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
To be able to group the records, fluid will load every record itself and groups those afterwards.
|
||||
If you plan to group many records just for getting something like a count, maybe it is better to fire the query directly and don't use fluid for that.
|
||||
|
||||
However if the result is on a cacheable page, the issue is only relevant on the first hit.
|
||||
@@ -0,0 +1,66 @@
|
||||
.. include:: /Includes.rst.txt
|
||||
|
||||
|
||||
.. _tutorial-templates:
|
||||
|
||||
Working with the templates
|
||||
==========================
|
||||
The following tutorials describe how to work best with the provided templates
|
||||
|
||||
Modify the templates
|
||||
--------------------
|
||||
If you want to adopt the templates, copy the ones of `tt_address` to your site package extension (or to fileadmin if
|
||||
you really need to ...) and provide the path in TypoScript.
|
||||
|
||||
.. code-block:: typoscript
|
||||
|
||||
# Use either constants or setup
|
||||
|
||||
# constants:
|
||||
plugin.tx_ttaddress.view {
|
||||
templateRootPath = path/to/your/tt-address-templates/Templates/
|
||||
partialRootPath = path/to/your/tt-address-templates/Partials/
|
||||
layoutRootPath = path/to/your/tt-address-templates/Layouts/
|
||||
}
|
||||
|
||||
# or setup
|
||||
plugin.tx_ttaddress.view {
|
||||
templateRootPaths.10 = path/to/your/tt-address-templates/Templates/
|
||||
partialRootPaths.10 = path/to/your/tt-address-templates/Partials/
|
||||
layoutRootPaths.10 = path/to/your/tt-address-templates/Layouts
|
||||
}
|
||||
|
||||
|
||||
Access to current content element data
|
||||
--------------------------------------
|
||||
The full data of the current content element can be accessed in the view by checking the variable `contentObjectData`.
|
||||
|
||||
.. code-block:: html
|
||||
|
||||
<f:debug inline="1">{contentObjectData}</f:debug>
|
||||
|
||||
Section in partial Address
|
||||
--------------------------
|
||||
To minimize code duplication the partial `Partials/Address` includes often used parts of the template. Currently there are:
|
||||
|
||||
- `address`: The address itself
|
||||
- `position`: The position of the address
|
||||
- `contact`: All including contacts and the birthday
|
||||
- `social`: All social links
|
||||
|
||||
To use one of the partial you just need to call
|
||||
|
||||
.. code-block:: html
|
||||
|
||||
<f:render section="social" partial="Address" arguments="{_all}"/>
|
||||
|
||||
Templates
|
||||
---------
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 5
|
||||
:titlesonly:
|
||||
|
||||
GroupAddressRecords/Index
|
||||
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
.. include:: /Includes.rst.txt
|
||||
|
||||
|
||||
.. _tutorial-addressRepository:
|
||||
|
||||
Usage of AddressRepository in custom extension
|
||||
==============================================
|
||||
If you need to output addresses in your custom extension you can follow this short tutorial.
|
||||
|
||||
All you need to do is adopt the following code to your needs:
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
<?php
|
||||
|
||||
$addressRepository = GeneralUtility::makeInstance(\FriendsOfTYPO3\TtAddress\Domain\Repository\AddressRepository::class);
|
||||
|
||||
// single selection
|
||||
// which means: output addresses in given order
|
||||
$demand = new \FriendsOfTYPO3\TtAddress\Domain\Model\Dto\Demand();
|
||||
$demand->setSingleRecords('12,34'); // Ids of tt_address records;
|
||||
$addresses = $addressRepository->getAddressesByCustomSorting($demand);
|
||||
|
||||
// list action
|
||||
$demand = new \FriendsOfTYPO3\TtAddress\Domain\Model\Dto\Demand();
|
||||
$demand->setPages(['12']); // list of pages where records are saved
|
||||
$demand->setCategories('1,3'); // list of categories desired address records need to be assigned to
|
||||
$demand->setCategoryCombination('or'); // combine given categories either by "or" or "and"
|
||||
$demand->setSortBy('last_name'); // order field
|
||||
$demand->setSortOrder('asc');
|
||||
$addresses = $addressRepository->findByDemand($demand);
|
||||
|
||||
$this->view->assign('addresses', $addresses);
|
||||
Reference in New Issue
Block a user