Skip to content

Instantly share code, notes, and snippets.

@benjaminrau
Created April 9, 2014 09:20
Show Gist options
  • Save benjaminrau/10246131 to your computer and use it in GitHub Desktop.
Save benjaminrau/10246131 to your computer and use it in GitHub Desktop.
Extend EXT:fluidcontent_core with textpic CType
<?php
namespace Vm\Vmtemplates\Controller;
/*****************************************************************
* Copyright notice
*
* (c) 2014 Benjamin Rau <rau@codearts.at>
*
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
*****************************************************************/
use FluidTYPO3\FluidcontentCore\Controller\CoreContentController as AbstractCoreContentController;
class CoreContentController extends AbstractCoreContentController {
/**
* @return void
*/
public function textpicAction() {
}
}
$GLOBALS['TYPO3_CONF_VARS']['FluidTYPO3.FluidcontentCore']['types'][] = 'textpic';
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
'Vm.Vmtemplates',
'Textpic',
array('CoreContent' => 'textpic'),
array()
);
$GLOBALS['TCA']['tt_content']['types']['textpic']['showitem'] = '--palette--;LLL:EXT:cms/locallang_ttc.xml:palette.general;general, --palette--;LLL:EXT:cms/locallang_ttc.xml:palette.header;header, bodytext;Text;;richtext:rte_transform[flag=rte_enabled|mode=ts_css], rte_enabled;LLL:EXT:cms/locallang_ttc.xml:rte_enabled_formlabel,--div--;LLL:EXT:cms/locallang_ttc.xml:tabs.images, image, --palette--;LLL:EXT:cms/locallang_ttc.xml:palette.imagelinks;imagelinks,--div--;LLL:EXT:cms/locallang_ttc.xml:tabs.appearance, --palette--;LLL:EXT:cms/locallang_ttc.xml:palette.frames;frames, --palette--;LLL:EXT:cms/locallang_ttc.xml:palette.imageblock;imageblock, --palette--;LLL:EXT:cms/locallang_ttc.xml:palette.textlayout;textlayout, --div--;LLL:EXT:cms/locallang_ttc.xml:tabs.access, --palette--;LLL:EXT:cms/locallang_ttc.xml:palette.visibility;visibility, --palette--;LLL:EXT:cms/locallang_ttc.xml:palette.access;access, --div--;LLL:EXT:cms/locallang_ttc.xml:tabs.extended, ,--div--;LLL:EXT:flux/Resources/Private/Language/locallang.xlf:tt_content.tabs.relation,tx_flux_column,tx_flux_children;LLL:EXT:flux/Resources/Private/Language/locallang.xlf:tt_content.tx_flux_children,,,';
plugin.tx_vmtemplates.bootstrap = USER
plugin.tx_vmtemplates.bootstrap {
userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run
vendorName = Vm
extensionName = Vmtemplates
}
tt_content.textpic >
tt_content.textpic < plugin.tx_vmtemplates.bootstrap
tt_content.textpic.pluginName = Textpic
{namespace flux=FluidTYPO3\Flux\ViewHelpers}
{namespace v=Tx_Vhs_ViewHelpers}
<f:layout name="CoreContent/NoHeader" />
<f:section name="Configuration">
<flux:form id="textpic">
<f:render partial="Properties/Header" arguments="{_all}" />
<f:render partial="Properties/Container" arguments="{_all}" />
</flux:form>
</f:section>
<f:section name="Preview">
{record.bodytext -> f:format.crop(maxCharacters: 100)}
</f:section>
<f:section name="Main">
{v:content.resources.fal(field: 'image') -> v:var.set(name: 'settings.images')}
<div class="row">
<div class="span2">
<f:if condition="{record.image_zoom}">
<f:then>
<f:for each="{settings.images}" as="image">
<a href="{f:uri.image(src: image.url, maxWidth: 1280, maxHeight: 1024)}" class="imageOverlay">
<f:image src="{image.url}" alt="{record.header}" width="435" />
</a>
</f:for>
</f:then>
<f:else>
<f:for each="{settings.images}" as="image">
<f:image src="{image.url}" alt="{record.header}" width="435" />
</f:for>
</f:else>
</f:if>
</div>
<div class="span3">
<header>
<p class="themeColored">{record.header}</p>
<h2>{record.subheader}</h2>
</header>
<div class="textBlock">
{record.bodytext -> f:format.html()}
</div>
</div>
</div>
</f:section>
@oliverbeck
Copy link

Hi
Thank you for the example. The TCA definition in ext_tables.php doesn't work for me. If I add a new textpic element, the "general" tab is empty

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment