6

I've a multi domain TYPO3 CMS installation where every of the X page trees has it's own page template and content elements build with FluidTYPO3.

At the moment the backend user sees all the templates and elements provided by the different provider extensions. The question is now: is it possible to disable page templates and content elements by some user defined conditions (fx if we are on a subpage of page Y only show page template A and content elements B,D and F?

Markus

Markus Bischof
  • 169
  • 1
  • 11

3 Answers3

2

The solution is to have separate TS configurations for separate sets of templates.

See following example:

your_ext/Configuration/TypoScript/Set1/setup.txt:

plugin.tx_yourext.view {
    templateRootPath = EXT:your_ext/Resources/Private/Set1/Templates/
    partialRootPath = EXT:your_ext/Resources/Private/Set1/Partials/
    layoutRootPath = EXT:your_ext/Resources/Private/Set1/Layouts/
}

your_ext/Configuration/TypoScript/Set2/setup.txt:

plugin.tx_yourext.view {
    templateRootPath = EXT:your_ext/Resources/Private/Set2/Templates/
    partialRootPath = EXT:your_ext/Resources/Private/Set2/Partials/
    layoutRootPath = EXT:your_ext/Resources/Private/Set2/Layouts/
}

your_ext/ext_tables.php

\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addStaticFile($_EXTKEY, 'Configuration/TypoScript/Set1', 'Templates Set1');
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addStaticFile($_EXTKEY, 'Configuration/TypoScript/Set2', 'Templates Set2');

So, then you can include desired set at specified TS template in a tree. E.g. your structure is:

root
 |
 |- Home1 (TS Template)
 |   |
 |   |- Page 1
 |   |- Page 2
 |- Home2 (TS Template)
     |
     |- Page 1
     |- Page 2

Then you can include "Templates Set1" at your "Home1" TS template, but "Templates Set2" at your "Home2" TS template.

The only drawback: you can't use two sets at same time on same page.

More info at offcial manual.

Update 05.03.2015: A ticket was created to track issue with no possibility to unset custom CEs, and now this issue is finally solved. So, taking an example from commit message above, one could do this:

# disable the "Alert" element:
plugin.tx_fluidbootstraptheme.forms.alert.enabled = 0
Viktor Livakivskyi
  • 3,178
  • 1
  • 21
  • 33
  • This does not work in my setup... I have a page tree using fluidcontent, and one not using it. The one *not* using `fluidcontent` has not a single template path pointing to to the extension providing the fluidcontent templates, but the content elements still appear in the "new content element"-wizard. I have the line `\FluidTYPO3\Flux\Core::registerProviderExtensionKey('Foo.Bar', 'Content');` in my `ext_localconf.php`, which is probably causing the problem. – Jost Dec 26 '14 at 15:57
  • That was one of my first ideas. A big drawback of this solution is, that you can not use the same templates in different tree roots without copying them. As a reason of that I'm looking for a solution to disable single templates. – Markus Bischof Dec 28 '14 at 07:26
  • @Jost I've tried this with my setup and can confirm, that I wasn't able to disable custom CEs for a separate tree. Therefore I've cretaed a [ticket](https://github.com/FluidTYPO3/fluidcontent/issues/204) at Github repo of fluidcontent ext. So, you can track on it. – Viktor Livakivskyi Dec 29 '14 at 11:40
  • @MarkusBischof what if you have a complete set of templates somewhere in fileadmin/templates folder, but your template sets inside of provider ext are just a symlincs to desired templates in fileadmin? Not ellegant, but may allow you to reach your goals. – Viktor Livakivskyi Dec 29 '14 at 11:42
0

What I have done for a project is to generate a directory tree based on the site name:

  • site1
    • templates
    • layouts
    • Partials
  • site2
    • templates
    • layouts
    • Partials

I than created:

plugin.tx_yourprovidername.settings.sitename = site1

I could then use this in my template :

<f:layout name="{settings.sitename}/nameoflayout"/>
rob-ot
  • 1,264
  • 8
  • 10
  • 1
    That do not really solve the problem since it does not remove the entries from the **Page Layouts** tab - or am I missing something? – Markus Bischof Dec 12 '14 at 08:18
0

there is at least a way to hide elements and tabs in the new content wizard. Add this to your page tsconfig and make sure you include it in your page tree (properties > resources > typoscript configuration):

mod.wizards.newContentElement.wizardItems.common.show =

This line will hide the "common" tab in the new content wizard. If you group your ce templates accordingly you can controll which elements are shown for a given page tree. You can also hide single elements using ":= removeFromList(yourElement1, ...)".

Keep in mind that this will only work for the new content wizard. When editing an element you can still select any ce from the "Fluid Content type" dropdown.

I'm still looking for ways to show and hide page templates and disable certain elements. I'll try to update this answer as soon as I find something :)

Cheers ...

MrPiff
  • 1
  • 1
  • This will only remove from the newContentElement tab. To also disallow the user to select it when editing the content, add this on PageTSConfig: TCEFORM.tt_content.CType.removeItems = {content_name} – José Ricardo Júnior Jun 09 '17 at 15:57