Add limit to Content Element - typo3

I setup a website with TYPO3 9x and I inserted a Content Element with this type :
Categorized content [menu_categorized_content]
The objective is to show the contents that are in a given category.
But I need to limit the number of content records to show only 3 records.
How can I add this function to limit to number of content ?

TYPO3 is using the DatabaseQueryProcessor to fetch the records from DB.
Your can find the settings in:
typo3/sysext/fluid_styled_content/Configuration/TypoScript/ContentElement/MenuCategorizedContent.typoscript
The DatabaseQueryProcessor uses the default .select syntax from TypoScript, you can find the Docs here: https://docs.typo3.org/m/typo3/reference-typoscript/master/en-us/Functions/Select.html#comprehensive-example
You can just add this to your TypoScript:
tt_content.menu_categorized_content.dataProcessing.10.max = 3

Related

TYPO3 find tt_content from pages

I'm using TYPO3 10.4.14
I believe, that I understood the relationship of pages and tt_content. But I have not figured out, how to get the tt_content elements and the order from the table pages.
From tt_content it is easy to get the page, but not from pages to tt_content.
What I finally want to do, is to mark a page (additional column), for display the beginning of the page in an overview.
For that I need the content elements of a page!
Edit:
I want to do t with database query.
One possible way would to use the uid of pages and go to the tt_content and search there for the pid. But this is a long winded way.
How is TYPO3 it doing, when display the pages?
you have multiple ways to render any output (typical HTML):
typoscript
PHP
FLUID
(in the end all is PHP, but regarding what you are programming or configuring)
If you want to render some regular content of the current page you will use the defined typoscript styles.content.get (with modifications), which is a TypoScript CONTENT object. This will do a query to get those tt_content records which belong to the current page in the default (or other) column. This results in a query like SELECT * FROM tt_content WHERE pid = current_page_uid AND column = 0 (and some additional conditions regarding visibility (hidden, starttime, endtime, workspace, ...)
This could be assigned to a FLUID variable or requested by a viewhelper (f:cObject).
If you want to get content from another than the current page you need to do a similar request and use another page uid. Either you build your own CONTENT object and use it like the default content. Or you build an own viewhelper in PHP which you can use in FLUID. You can modify the query by reducing the number of records you consider, you also can modify the rendering regarding which fields will be shown in what HTML markup.
Depending on the package you use it may contain already specialized viewhelper which gets you the content of other pages and/or other columns.
I think you want to build teasers for other pages with the content of that pages.
Consider to use a special field in the pages record which contains a clean summary for the page content. Not each page has relevant or recognizable information in the first paragraph.
It's the same as for search engines: if you provide search engines with a summary, that will be shown at the search results and the searcher can better decide if this page is relevant for him.

TYPO3 backend searches

There are two different search fields in TYPO3 backend - as in attachement.
1 - search displayed above list and page module
2 - main TYPO3 backend search
(https://ibb.co/vQZGTq0)
Does those searches use different configuration?
I have some custom table and field which I want to be searched against in case of search 1 and 2. In my table TCA I have added my field to searchFields.
I can find my record by search 2. but not 1.
Search 1 only searches on current page, while search 2 searches within whole installation.
Therefore if you record is on a different page then currently selected, it will only be found by global search (2).

List all "incoming" internal links / references to a TYPO3 element

I need to get a list of elements linking to a specific TYPO3 page or element (all IDs oder pages, that link or refer to a this element). I thought this was at the Info module, but I can't find it.
I have spent hours finding this info on the web and even in my oldschool TYPO3 manual book... nothing, but I know that I once had this list.
Thanks a lot in advance! (version is TYPO3 4.6, I am preparing an upgrade right now)
You could search your database manually to find such links. I will start to give you a list where you could search for.
Find tt_content headers which link to a page, element or any url:
SELECT * FROM tt_content WHERE header_link NOT LIKE '' AND deleted = 0;
In RTE fields, you could manually check.
Go to backend modul 'Configuration', choose '$TCA (Tabel configuration array)' and search for 'RTE'.
Then you schould get all RTE fields, which could have links set to any TYPO3 pages or elements.
Like fx: tt_content.bodytext.config.wizards.RTE...
These fields you could search for any links vis MySQL
SELECT * FROM tt_content WHERE bodytext LIKE '%<link%' OR bodytext LIKE '%<LINK%' AND deleted = 0;
Maybe someone can add more default fields not listed above.
I think you have seen the references of a record normaly seen in the list module.
If you hover your mouse over the count you get a list of origins.
That list is not always up to date and the usability of the origins differs from version to version. Sometimes you can use the origins as direct link to edit the origin record.
Maybe you had an extension which enhances the usage.
In gerneral: if records are used with TYPO3 (TCA group fields which build relations to other records with uid-lists, or mm-records) this is also stored as refrence.
As links are also relations they are not always stored as referenes, espeacially if the link is inside a textfield.

TYPO3 Insert records element: detect number of items

Is there any way to detect in fluid or typoscript (or anything else) if an "Insert Records" CE from fluid_styled_content contains one or multiple items?
The use case:
I use "insert records" to display contacts from a custom extbase extension on a page, and I'd like to get a different title and layout if there are one or several items.
Insert Records is rendered using the RECORDS content object. In \TYPO3\CMS\Frontend\ContentObject\RecordsContentObject::render() I see no option to read the number of items or the current item number that is rendered from the contentObjectRenderer object that renders a single item.

Drupal 8 - Repeatable Form Fields

I am looking to build a module in Drupal 8 after having used Joomla. The issue I'm having is that I can't seem to find a way to configure additional fields where required. Similar to this method in Joomla if possible so that I can add more of the same fields e.g multiple contact number boxes.
It is recommended to use Paragraph instead of field collection for Drupal 8 projects.
Check
Field Collection
It's drupal entity based module that allow you to create repeater fields.
You can create group of fields and embed them into existing content types.
example:
Your Collection:
Item 1:
title
body
image
Item 2:
title
body
image
Add another item