TYPO3 Custom Content Element with repeatable fieldsets or '+ Content' Button - typo3

So, I'm new to TYPO3. I worked myself through some guides and documentations to be able to create custom content elements on my own.
Now, for one of my desired content elements, I need to have a set of fields I want to be able to make repeatable, since I want to leave the choice up to the editor, how many of the sets he wants to add.
I'm running on TYPO3 version 7.6
I have already seen both options in existing content elements:
Content elements that work like a wrapper where you can add additional content elements within and
Content elements where you can add fieldsets within its configuration.
I'm searching for examples or written guides to recreate this, since I can't figure it out from the source code of those examples I've seen.
Edit(27.12.16):
So after seeing a few reactions and replies, I want to further clarify what I'm looking for.
I do NOT need an assistant plugin to create new content elements, I'm already past that.
Let me draw an example, to better describe what I want to achieve.
I do already have a working Content Element.
I have defined a set of fields (for example name & phone) shown in the TYPO3 backend. Now I want to leave the choice to the editor, if he just wants one set of 'name & phone' fields, or 2, or 8.
Therefore I want to create a '+'-button or something like that, for the editor to click on to make a new input set of 'name & phone'-inputs.

There is an extension called mask, with that you can simply click together your own content element with many different kinds of relations and fields.
Then there is a second extension mask_export that exports your new content elements into an own extension.
With those you can just create a very basic content element
export it
see what code was generated
add more to your content element
export it
check the code
and so on :-)

Related

How to put content elements side-by-side int typo3

I have just started my Typo3 journey. I want to put 2 content elements side-by-side (in one row). Can anyone tell how is it possible. Because whenever I place any content element, it is displayed as a block and fill the entire row.
Thank you for your time and consideration :)
You have to use container elements which come with the extension 'container'. Please have a look at https://extensions.typo3.org/extension/container
There is no build in solution for your problem.
But in TYPO3 you are free to build any kind of html structure for your output. This is necessary as you also can do any rendering of content. either with your own CSS and HTML-markup or if you use frameworks like Bootstrap.
You can build a new page layout, or any special content element which contains other content elements.
Changing layouts can (and should) be reflected in backend-layouts. (https://docs.typo3.org/m/typo3/reference-coreapi/11.5/en-us/ApiOverview/Backend/BackendLayout.html) (there are a lot of other tutorials)
But you also can build/ use individual defined containing content elements. Her you can get support by different extensions (eg. mask, DCE, gridelements) or define it completely on your own (https://docs.typo3.org/m/typo3/reference-coreapi/11.5/en-us/ApiOverview/ContentElements/Index.html)

TYPO3: Difference between Plugin and Custom Content Element?

I have to implement a media download feature. The backend user should be able to upload a media file, set the title, description, release date and so on... The result should then be visible and the file available for download in the frontend.
I am not sure what is the best way to achieve this: Plugin or Custom content element ?
Whats the main difference between the two and what would be the best solution for my task ?
Plugins are used for more complex rendering of records with different views (for example a list and a detail view of records stored somewhere in a storage folder). A custom content element (CE) should be preferred if all relevant data is stored in the record.
For your case, a Content Element seems to be the right solution. This kind of custom content elements can also be easily created with helpful extensions like "mask" which may takes you 10 minutes to create a custom CE.
https://typo3.org/extensions/repository/view/mask
If I understood you properly.
You can define plugin as type of "list_type", or as "CType" (if you need to code specific function, which is hard or unable to achieve using eg. Fluid contents) or even as another menu type defined as "menu_type".
These all types can be the same way made plugin, this separation for types are basically only for making it appear in different selectors. So:
your plugin defined as menu_type is to be selected in "Special Menus" content type in "Menu type" selector,
defined as list_type (so called) is to be selected in "Insert Plugin" content in "Selected plugin" selector,
defined as CType is totally new content type.
But they work the same way and this is easily to be switched using parameter in ext_tables plugin register call:
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPlugin( ['Label', $_EXTKEY.'_myPluginSuffix'], 'CType');
1) You can use the "File Link" content element and adapt its TypoScript (tt_content.uploads.20.renderObj) to your needs.
2) You can use the file_list extension and adapt its Fluid templates to your needs

Display System Categories in TYPO3-FE

I am trying to build my first own extension with the Extension Builder. Up to now everything worked really well, but now I've got a problem and am not able to find a solution:
My extension looks like this: You can add new Entries in the backend under List (the entry on the right panel). These entries are then shown in the frontend.
While adding new entries there is the possibility in the horizontal navigation bar to link this entry to specific categories. I've already done this with every entry.
But how can I display this category in the fronted. It should be just one <div> like Linked Categories: CATEGORY.
It seems like there is no ViewHelper which can display all linked categories.
I've already googled a lot, but this just confused me more: It seems like its not possible with a simple ViewHelper. There was a solution, where one had to edit the controller. But I did not like this because then I can not continue working with the Extension Builder or it becomes overwritten.
I also looked in the code of tx_news. It seems like all categories are in a variable there, which can be looped. But in my extension <f:debug>{categories} was always NULL.
Is there no ViewHelper which can display the categories, or anything else? Maybe a good tutorial (I am good in PHP, but new to TYPO3).
Thank you very much in advance,
Felix
P.S: I am using TYPO3 CMS 7.6.9
the Extension Builder is just a 'kickstarter' that helps you define your models and actions, relations etc ... It will not do more then that. So once you created your extension draft, it's best to forget about the extension builder and try to understand the structure of an extbase extension (the MVC, TCA, localconfig, typoscript,...). If you need to add a new property, do it manually. You will learn a lot more about your extension and how it works.
Having this said, you will have to adjust your extansion yourself to add categories. There are a few ways to do it: you can add your own category system by adding your own category Model, or use the TYPO3 category API
https://docs.typo3.org/typo3cms/CoreApiReference/ApiOverview/Categories/Index.html
There is also no plug&play category viewhelper. If you like to be able to list your entries by category, you will need to adjust your controller.
You can add some functionality to an existing on, for ex. your listAction so that it reads arguments send to this action (a list of categories you like to filter on) or create a new one called for example categoryAction.
extbase reference :
https://docs.typo3.org/typo3cms/ExtbaseFluidBook/b-ExtbaseReference/Index.html
stackoverflow question about categories in a controller:
Controllers and Template (how to filter results correctly or give arguments via backend?)
bottom line:
- skip extension builder
- learn how to adjust the MVC yourself
you can always join the TYPO3 slack channel :
https://typo3.slack.com/
it's free and people are very helpfull
good lcuk

Preferred way to add an extensions into Fluid Powered TYPO3 template

im working with Claus' Fluid Powered TYPO3 and I'm quiet happy with it. At the moment I have to implement a template wich should contain another extension (e.g. news) in the sidebar.
What is the preferred way to implement this.
My idea was to add the f:cObject ViewHelper and insert the extension in that way.
Is this the correct approach?
Thx
Markus
This depends on the type of template you are building:
Page templates should have proper content areas into which you can insert content. If the content needs to be shared, you have a few options: a) create the element in a sys folder and reference it from your Flux form settings then use v:content.render to render it by UID. b) Place any number of shared elements in a sys folder and render all by PID. c) Use content sliding in a column in your template which is there in all templates and is designed to contain elements which "slide" to every subpage (and can also be edited on subpages if editor has access).
Content templates can use flux:grid with flux:form.column, or flux:form.content as a shortcut to quickly make a single column, to add a content area, then flux:content.render to render those elements. This allows you to control that gets rendered around the plugin.
Plugin templates can associate a Flux form and use the steps described in point 2.
I think you're looking for 1a) or 1c) in this case.

jQuery Show/Hide divs using same class not working because of html.push?

The object is to Show-Hide text located under their respective Titles, so a User reads the title and shows or hides text belonging to that title if the User wants to read more.
I tried whatever I could find so far on here, we're talking dynamically setting text coming from a spreadsheet, can't use IDs, must work with .class, must be missing something, I have this piece of code:
... html.push('<div class="comments">' + comment + '</div></div></div>');
but when I try this Show-Hide code nothing happens, even if the error console shows nothing. Basically I want to Show-Hide the .comments class divs with a show-hide toggle link located under each of them. I say them because the .comments divs are reproduced dynamically while extracting text coming from Google spreadsheet cells/row (one .comments div per spreadsheet row). I tried .next, child and parent but they all divorced me so I dunno looks like a dynamic issue. So far I only managed to globally toggle all divs to a visible or hidden state but I need to toggle independantly individual divs.
I prefer a jQuery solution but whatever worked so far was achieved with native javascript.
Note: If a cross-browser truncate function which would append a more-less link after a number of words (var) in each .comments divs would be easier to implement then I would gladly take that option. Thx for any help, remember I am still learning lol!
I have been working on an entirely JS UI project and have brought myself to using $('', { properties }).appendTo(BaseElement) to work best for adding HTML elements because it appropriately manipulates the DOM every time.
If you are having good luck with push elsewhere, however, breakpointing on the line where you do your $('.class').hide() and see what $('.class').length is. Alternately, you can just add alert($('.class').length) to your code if you are unable to breakpoint the code. If it is 0, then your elements have not been properly added to the DOM. Changing to append will ensure they are part of the DOM and therefore targetable via JQuery.