Wrap H1-H6 Tags with Typo3 ParseFunc depending on the class set in RTE - typo3

I want to add inline-svgs to my h1 to h6 Tags depending on the class set in the RTE.
Example:
RTE:
<h1 class="icon--clock">Header</h1>
Output:
<h1 class="icon--clock"><svg>...</svg>Header</h1>
I've done something similar with links before, using the parseFunc Config. A method like this: https://wiki.typo3.org/External_links
Is there any way to access and split the tag and class like the link parameters through TypoScript?
I also tried using a userFunc
lib.parseFunc.userFunc = ...\MyClass->MyUserFunc
but in Params I only get the tag content, not the tag or the classes that have been set themselves.
I'm using Typo8 with the ckeditor, but I don't think that makes a difference.
Can I even do this?
How do I do this?
I know that I can alternatively add different header layouts and use the tt_content header field, because it's easier to manipulate the template there. But I'd love to know if there is a way to this in the RTE.

I think you could do it in typoscript, but that would be very complicated as you need to analyze the attributes of the Hn-tags.
A simpler method which came to mind would be: use CSS and ::before. So you can use a selector to the class to insert the matching SVG.
This also can be done with javascript but as CSS can do it it would be more efficient to use CSS.

Related

HTML5 Custom Data Attributes in TYPO3 Backend Content Elements

I am wondering if there is a way to add a HTML5 Custom Data Attribute to any Content Element like Text or Text w/ images.
Anyone tried / did this before or is there a good reason not to do this?
You can either add a new field (own extension) or use any of the existing (e.g. layout to define own values. Then you can change the TypoScript rendering based on the value of this field.
... or in addition to #pgampe's answer, which is fine for programmers you can use ie. DCE extension, which allows you to create any HTML structure with usage pure Fluid syntax
Thank's for the answers. I didn't know DCE, looks very interesting.
As I needed a quick solution for just a few elements on one page I did something really quick and dirty. But as it worked for me, I would like to post it in addition to the two other excellent answers.
I used the field Description field to add the content of my custom field. I know it's not intended for this, but as alreay mentioned: quick & dirty. :-)
tt_content.stdWrap.innerWrap.cObject {
50 =< tt_content.stdWrap.innerWrap.cObject.default
50.20.10.value = csc-default layout-{field:layout}" data-filter="{field:rowDescription}
50.20.10.insertData = 1
}

Tinymce: allow userdefined tags

Tinymce is removing unknown tags. I want to use userdefined tags, but I did not find the allowed Tags and their rules defined in Tinymce 4 to adjust it?
I want insert my own tags with the function: tinyMCE.activeEditor.dom.create, so tiny adds and accept it like the mark-Tag:
<mark>Mytext</mark>
so it should look like this
<user-tag>Mytext</user-tag>
You should have a closer look into the documentation.
Try custom_elements.

tx_news Paginate with dynamic variables

I have created a custom template for paginations. But I want to display a count of all news articels and so I'm looking for a solution to pass a variables to the pagination. I don't want to build a custom viewhelper, I want to stick with the original PagionationViewhelper.
Maybe have anyone a idea?
Make the counting with a cObject like lib.newscount
then you pass that with the cObject Viewhelper like:
<f:cObject typoscriptObjectPath="lib.newscount"></f:cObject>

Typo3: classes for elements

I have 3 different kinds of in my website, and I want to give be able to give different classes from the backend using the RTE from the Text Element. It should look like this:
<ul class="type2">
....
</ul`>
I thought I should use one of the 3 boxes from the RTE, probably "blockstyle", but im not sure how to add new options to this dropdow. Can someone please help me? Thanks!
The standard RTE editor (rtehtmlarea) populates the class list by parsing the CSS file that you set for it so all you need to do is to define ul.type2 in that CSS file. See the manual of the extension and search for contentCSS property. Example:
RTE.default.contentCSS = fileadmin/template/rte.css
Note that you might have to set it also for each table, e.g.:
RTE.config.tt_content.bodytext.contentCSS = fileadmin/template/rte.css
This depends on your configuration and whether you already have default settings (RTE.default) copied into other configurations. See Info -> [page] -> Page TSconfig -> RTE. for your current settings.

How to fusion two content elements? / Does an all in one content element exist?

I need a content element that cointains apsects from the "Textpic" and the "Media" content elements.
Basically I need the whole palette of input masks of the textpic CE (headline, rte text, images) plus the media tab (swf, mp4, mov) from the media content element.
This special requirements for our project comes from the need that we can only use one content element for our specific javascript content slieder. So I can not use like a Textpic and underneath a media CE. No it really has to be just one CE which can handle the textpic + the media CE stuff.
Generally I ask you: Is there already a extension, trick, modification or a framework which I can/should be use to achive that i can "fusionate" content elements? Like an "all-in-one"-content element, a multi content element?
Ps: I do not use Templavoila. My Typo3 version is 4.5
I think this is the tutorial you're looking for:
http://castironcoding.com/resources/our-blog/sp/view/single/post/reason-6-for-choosing-typo3-custom-content-elements-and-extbase-again-part-23.html
Follow step 2 and 3.
You'll also need to add a specific rendering config in Typoscript ie: tt_content._your-ce_
But it can be copied from out of tt_content.textpic and tt_content.media. You can find the expample typoscript of before mentioned CE's in: typo3/sysext/css_styled_content/static/setup.txt. Just don't alter it there, but make a copy and alter in your own file.
As you seem to only talk about reusing already exisiting fields, you really only need to change the backend interface (big keyword: "showitem"). You'll need the database names of the fields (peek into the tt_content table of some records where you know the contents), alternatively visit the module Admin Tools / Configuration, select TCA in top dropdown menu, open tt_content and columns.
Try http://blog.chandanweb.com/typo3/adding-new-fields-to-existing-typo3-tables-at-desired-location, you'll of course have to substitue tt_content for tt_news etc.
You might also want to make a new type (the above recipe is for changing a preexisitent), but I'm sorry, I'm currently out of time for explaining that. It's not very hard, though, and the castiron link by Koopa will help you on your way.
Perhaps you can wrap the content column in another div? You can use that outer div for your content slider. Now you actually use all content elements seperately, but combine then for usage.