b13 / container Goto Github PK
View Code? Open in Web Editor NEWA TYPO3 Extension for creating custom nested content elements
License: GNU General Public License v2.0
A TYPO3 Extension for creating custom nested content elements
License: GNU General Public License v2.0
Hi ๐
I am currently testing container with workspaces and it seems like that previewing in the FE is not working as expected. The Staged Version is always empty when debugging renderedContent
so nothing is showing in the FE.
This PR #88 removed these line in Classes/DataProcessing/ContainerProcessor.php
and might be the cause of the bug:
if ($child['t3ver_oid'] > 0) {
$conf['source'] = $child['t3ver_oid'];
} else {
$conf['source'] = $child['uid'];
}
Manually re-adding these line back seems to work and previewing work as expected.
Specs:
Hi ๐
while testing container with workspaces i might found a bug when moving records.
Tested scenario:
The last scenario failed.
Specs:
I haven't found a solution yet and am still debugging, will report back when finding more.
uid | pid | sorting | t3_origuid | t3ver_oid | t3ver_state | t3ver_count | t3ver_tstamp | t3ver_count | t3ver_move_id | colPos | tx_container_parent |
---|---|---|---|---|---|---|---|---|---|---|---|
38 | 1 | 64 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
39 | 1 | 128 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
uid | pid | sorting | t3_origuid | t3_origuid | t3ver_oid | t3ver_state | t3ver_count | t3ver_tstamp | t3ver_count | t3ver_move_id | colPos | tx_container_parent |
---|---|---|---|---|---|---|---|---|---|---|---|---|
38 | 1 | 64 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
39 | 1 | 128 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
40 | 1 | 128 | 39 | 39 | 39 | 4 | 0 | 0 | 0 | 0 | 0 | 0 |
41 | 1 | 32 | 0 | 0 | 0 | 3 | 0 | 0 | 0 | 39 | 0 | 0 |
uid | pid | sorting | t3_origuid | t3_origuid | t3ver_oid | t3ver_state | t3ver_count | t3ver_tstamp | t3ver_count | t3ver_move_id | colPos | tx_container_parent |
---|---|---|---|---|---|---|---|---|---|---|---|---|
38 | 1 | 64 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
39 | 1 | 128 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
40 | 1 | 128 | 39 | 39 | 39 | 4 | 0 | 0 | 0 | 0 | 101 | 42 |
41 | 1 | 32 | 0 | 0 | 0 | 3 | 0 | 0 | 0 | 39 | 101 | 42 |
42 | 1 | 96 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 |
43 | 1 | 96 | 0 | 0 | 42 | -1 | 0 | 0 | 0 | 0 | 0 | 0 |
44 | 1 | 64 | 38 | 38 | 38 | 0 | 0 | 0 | 0 | 0 | 101 | 42 |
uid | pid | sorting | t3_origuid | t3_origuid | t3ver_oid | t3ver_state | t3ver_count | t3ver_tstamp | t3ver_count | t3ver_move_id | colPos | tx_container_parent |
---|---|---|---|---|---|---|---|---|---|---|---|---|
38 | 1 | 64 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
39 | 1 | 128 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
40 | 1 | 128 | 39 | 39 | 39 | 4 | 0 | 0 | 0 | 0 | 101 | 42 |
41 | 1 | 32 | 0 | 0 | 0 | 3 | 0 | 0 | 0 | 39 | 101 | 42 |
42 | 1 | 96 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 |
43 | 1 | 96 | 0 | 0 | 42 | -1 | 0 | 0 | 0 | 0 | 0 | 0 |
44 | 1 | 64 | 38 | 38 | 38 | 0 | 0 | 0 | 0 | 0 | 101 | 42 |
uid | pid | sorting | t3_origuid | t3_origuid | t3ver_oid | t3ver_state | t3ver_count | t3ver_tstamp | t3ver_count | t3ver_move_id | colPos | tx_container_parent |
---|---|---|---|---|---|---|---|---|---|---|---|---|
38 | 1 | 64 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
39 | 1 | 128 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
40 | 1 | 128 | 39 | 39 | 39 | 4 | 0 | 0 | 0 | 0 | 101 | 42 |
41 | 1 | 0 | 0 | 0 | 0 | 3 | 0 | 0 | 0 | 39 | 101 | 42 |
42 | 1 | 96 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 |
43 | 1 | 96 | 0 | 0 | 42 | -1 | 0 | 0 | 0 | 0 | 0 | 0 |
44 | 1 | 64 | 38 | 38 | 38 | 0 | 0 | 0 | 0 | 0 | 101 | 42 |
45 | 1 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 102 | 42 |
46 | 1 | 1 | 0 | 0 | 45 | -1 | 0 | 0 | 0 | 0 | 102 | 42 |
47 | 1 | 2 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 102 | 42 |
48 | 1 | 2 | 0 | 0 | 47 | -1 | 0 | 0 | 0 | 0 | 102 | 42 |
In TYPO3 9, I get this error in page module when it contains a container element:
Fatal error: Access level to B13\Container\View\ContainerLayoutView::$nextThree must be public (as in class TYPO3\CMS\Backend\View\PageLayoutView) in /var/www/html/v9/public/typo3conf/ext/container/Classes/View/ContainerLayoutView.php on line 0
In TYPO3 10, the same configuration works. I've used the default configuration from README.md
My first TYPO3 10 with the Container Extension - what a cool extension, great work!
but i have one issue.
I don't know if it is a bug in content_defender or in the container extension. I will try it here.
In the BackendLayout of the page template a allowed list is defined:
mod {
web_layout {
BackendLayouts {
default {
title = Default
config {
backend_layout {
colCount = 1
rowCount = 1
rows {
1 {
columns {
1 {
name = Main Content
colPos = 0
allowed {
CType = list, shortcut, div, uploads, shortcut, html, gridcol1left
}
}
}
}
}
}
}
}
}
}
}
On the page I add a container grid element (gridcol1left).
In the container element I add a text element.
So far everything works fine.
But if I copy and paste the container element, the following two error messages appear:
The record "Text" couldn't be saved due to disallowed value(s).
Attempt to insert record on page '[root-level]' (0) where this table, tt_content, is not allowed.
It looks like trying to copy the text element directly into the page template, which is not allowed.
If i remove the allowed Ctype list in the BackendLayout, everything works fine.
Setup:
TYPO3 10.4.7
Container 1.1.1
contend_defender: 3.1.0
Hello,
as you're working with variables ($packageManager) in ext_localconf.php this may generate side-effects with other extensions while merging all ext_localconf.php's into one big file. To prevent side-effects please wrap content into a call_user_func.
Stefan
The order of the parameter for registering a new CType could be changed to move the icon to a position after the grid configuration so a minimum configuration can consist of CType
, label
, description
, and grid
.
public function registerContainer(
string $cType,
string $label,
string $description,
array $grid = [],
string $backendTemplate = 'EXT:container/Resources/Private/Templates/Container.html',
string $gridTemplate = 'EXT:container/Resources/Private/Templates/Grid.html',
string $icon = 'EXT:container/Resources/Public/Icons/Extension.svg',
bool $registerInNewContentElementWizard = true
): void
It would be great if the extension would provide couple of icons for the most used grid types like: 1col, 2col, 3col, 1/3+2/3, 2/3+1/3. What do you think?
The icons are a bit incosistent regarding the background color.
The icons container-2col-right
and container-3col
are using a transparent background, the others are using white
Since default icons are now shipped (thx for that!) it would be great to have labels for those containers as well. Some possible labels:
Hello,
please remove condition against TYPO3_MODE in ext_localconf.php
Stefan
we want to run our code analysis and tests automatically on github
I am unsure if the command name should be something like "container:integrity-check" instead of "integrity:run"?
Since I have installed EXT:container, it is no more possible to drag content elements. No matter whether the elements are in- or outside a container element.
The log says:
Core: Exception handler (WEB): Uncaught TYPO3 Exception: Argument 2 passed to B13\Container\Hooks\Datahandler\CommandMapPostProcessingHook::copyOrMoveChildren() must be of the type integer, string given, called in /public/typo3conf/ext/container/Classes/Hooks/Datahandler/CommandMapPostProcessingHook.php on line 49 | TypeError thrown in file /public/typo3conf/ext/container/Classes/Hooks/Datahandler/CommandMapPostProcessingHook.php in line 87. Requested URL: .../typo3/index.php?route=%%2Fajax%%2Frecord%%2Fprocess&token=--AnonymizedToken--&cmd[tt_content][29][move]=1&data[tt_content][29][colPos]=8-10&data[tt_content][29][sys_language_uid]=0
Otherwise I like the extension very much, good job, thanks!
Tobi
after installing container_example on TYPO3 9.5.9 i get the following error:
Call to undefined method B13\Container\Tca\Registry::addContainer()
Declaration of B13\Container\View\ContainerLayoutView::getIcon($table, $row) should be compatible with TYPO3\CMS\Backend\View\PageLayoutView::getIcon($table, $row, $enabledClickMenuItems = '')
Using the new version 1.1. I get the following error in the backend
Fatal error: Access level to B13\Container\View\ContainerLayoutView::$nextThree must be public (as in class TYPO3\CMS\Backend\View\PageLayoutView) in /xxx/xxxx/rp-hosting/xxx/xxx/typo3cms/projekt1/typo3conf/ext/container/Classes/View/ContainerLayoutView.php on line 309
TYPO3 9.5.19
Maybe you wanna provide an .gitattributes file to skip e.g. Build directory and other files?
depending on ordering of the containers in the command, or the children in the container results in wrong relations to tx_container_parent
(localze
and copyToLanguage
has same bug)
this happens because of the fixCopyAfterDuplFields()
Method which fetch diffent prevData
I think we can drop the $GLOBALS['TCA']['tt_content']['ctrl']['copyAfterDuplFields'] .= ',tx_container_parent';
Configuration, this solves the Bug. The Configuration was introduce at the beginning of the project at seems to be obsolete (all Tests runs still fine.)
I am very exited about this new approach!
But...
Installed container and container_example
Added a '2 Column Container With Header' to the page and got following error:
ERROR: Content Element with uid "1" and type "b13-2cols-with-header-container" has no rendering definition!
So in the typoscript is defined:
templateRootPaths {
10 = EXT:container/Resources/Private/Contenttypes
}
There is no such folder?
Or did I miss something?
Please update/precise the installation instruction.
seems they are not running yet
It would be nice to add a default container showitem configuration for container elements that do not provide a more expansive showitem configuration.
When registering a new container this "showitem" TCA configuration could be added; as long as there is no special configuration set up following the registration of the container this default setup will be used. It would make sense to add default fields (like CType, language, access) to a default configuration so the container is working in most instances.
Hello,
you are using strict data types nearly everywhere, but you are not using declare(strict_types = 1);
Please add this declaration in top of your PHP classes.
In your Container class you're missing an int type for $language in its contructor.
Stefan
Please add a @deprecated
to the method Registry::registerContainer
Hi,
right now, the B13\Container\DataProcessing\ContainerProcessor delivers 1-n "top-level" variables into the Fluid-Template (for example {children_101}, {children_102} etc.). This makes it hard to iterate over these columns to avoid repeating HTML-wrapping-markup. A fluidtemplate-variable like {containerColumns} that contains all the identified {children_*} elements would be nice.
Example for a traversable containerColumns variable in FLUIDTEMPLATE:
`
Hello,
In Database::getQueryBuilder() you only check against TYPO3_MODE BE, but in case of FE you should add FrontendRestrictionContainer instead of using the DefaultRestrictionContainer.
Stefan
EXT:container got the same issue Gridelements currently have: https://gitlab.com/coderscare/gridelements/-/issues/131
When "Fluid based page module" feature toogle is enabled, DCE's simple backend view is not rendered anymore, because it uses the new previewRenderer. In TCA you find it here:
Localize a container in Copy-Mode (copyToLanguage) should also localize the children in Copy-Mode and remap the tx_container_parent field
Currently the children are not localized.
It would be nice to make use of the new "saveAndClose" setting for the new content element wizard in v10 on automatic container registration.
As long as there are no additional, custom "showitems" settings it can be assumed that the container is only used as a means to create content areas to add child elements. In this case, the "saveAndClose" setting could be set to "true" by default.
see also: #23
we can simplify TS DataProcessor usage by autom. add 'children_' Variable to processedData if not explicite defined
allow non SVG Icons (e.g. PNGs) as Container-Icon
When you add content to container in default language and use "Translate" button in Page>Languages view, then translate configurator crashes on last step - loader does not disappear from view in fe and after browser refresh target child content is still not translated.
EXT:container 1.1.1, from TER
Typo3 10.4.6
Language - Strict, Connected mode
I would like to see a way to minimize the TypoScript configuration required, and assign the content for each colPos to a variable for Fluid automatically. This way a smaller TypoScript setup like this
tt_content.2col-container =< lib.contentElement
tt_content.2col-container {
templateName = 2col-container
dataProcessing.13 = B13\Container\DataProcessing\ContainerProcessor
}
could achieve the same result as this snippet:
tt_content.2col-container =< lib.contentElement
tt_content.2col-container {
templateName = 2col-container
dataProcessing {
201 = B13\Container\DataProcessing\ContainerProcessor
201 {
colPos = 201
as = children_201
}
202 = B13\Container\DataProcessing\ContainerProcessor
202 {
colPos = 201
as = children_202
}
}
by automatically assigning every available column to a default variable name.
Hi,
i am testing your extension right now. So far it works very well. Good job!
When testing quick and dirty with copy & paste i found some minor possible improvements:
In your TCA Example you are using the values 200, 201, 202.
Further down in the template and typoscript Example you are using 100, 101, 102
Found here: https://github.com/b13/container
This could be normalized to improve accessibility by people who are new to the TYPO3 game :)
Best regards,
Nico
wanna get rid of too much Parameters on
public function addContainer(
string $cType,
string $label,
string $description,
array $grid,
string $icon = 'EXT:container/Resources/Public/Icons/Extension.svg',
string $backendTemplate = 'EXT:container/Resources/Private/Templates/Container.html',
string $gridTemplate = 'EXT:container/Resources/Private/Templates/Grid.html',
bool $saveAndCloseInNewContentElementWizard = true,
bool $registerInNewContentElementWizard = true
)
so changing last parameter will not required all other parameters override ...
I did an update to version 1.1.0 in a TYPO3 10.4.5. installation via composer:
composer update b13/container --with-all-dependencies
After that, I only received an exception in Backend, Frontend an Installtool:
(1/1) InvalidArgumentException
Expected an implementation of "phpDocumentor\Reflection\DocBlock\Tag". Got: "TYPO3\CMS\Extbase\Reflection\DocBlock\Tags\Null_"
During the update, some dependencies were updated too:
Package operations: 2 installs, 12 updates, 0 removals
- Updating symfony/polyfill-ctype (v1.17.1 => v1.18.0): Downloading (100%)
- Updating symfony/polyfill-php80 (v1.17.1 => v1.18.0): Downloading (100%)
- Updating symfony/polyfill-mbstring (v1.17.1 => v1.18.0): Downloading (100%)
- Updating symfony/polyfill-php72 (v1.17.0 => v1.18.0): Downloading (100%)
- Installing paragonie/random_compat (v9.99.99): Downloading (100%)
- Installing symfony/polyfill-php70 (v1.18.0): Downloading (100%)
- Updating symfony/polyfill-intl-normalizer (v1.17.1 => v1.18.0): Downloading (100%)
- Updating symfony/polyfill-intl-idn (v1.17.1 => v1.18.0): Downloading (100%)
- Updating symfony/polyfill-intl-icu (v1.17.1 => v1.18.0): Downloading (100%)
- Updating symfony/polyfill-intl-grapheme (v1.17.1 => v1.18.0): Downloading (100%)
- Updating symfony/polyfill-php73 (v1.17.1 => v1.18.0): Downloading (100%)
- Updating webmozart/assert (1.9.0 => 1.9.1): Downloading (100%)
- Updating phpdocumentor/reflection-docblock (5.1.0 => 5.2.0): Downloading (100%)
- Updating b13/container (1.0.0 => 1.1.0): Downloading (100%)
Error:
In the backend (page module) I got a error message after adding a container and saving it.
Fatal error: Access level to B13\Container\View\ContainerLayoutView::$nextThree must be public (as in class TYPO3\CMS\Backend\View\PageLayoutView) in /var/www/html/public/typo3conf/ext/container/Classes/View/ContainerLayoutView.php on line 0
Steps to reproduce:
Configuration/TCA/Overrides/tt_content.php
\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\B13\Container\Tca\Registry::class)->addContainer(
'2col-container',
'2 Column Container',
'Insert an element dividing the content area into two columns',
[
[
['name' => 'Left Column', 'colPos' => 201],
['name' => 'Right Column', 'colPos' => 202]
]
]
tx_container_parent
of the live-Record-Child changed also (and so the change is direkt live).tx_container_parent
on live-Record-Child leeds to wrong rendering in WS, the WS-Record-Child is rendered in the original container.tx_container_parent
on live-Record-Child works)Hello,
I have tried copy&paste your example in README.md into my IDE which shows me some PHP errors.
After the closing ]
you have missed a comma and in each further line the commas are missing
Stefan
I want to use two container elements: A two column container and a three column container.
Using containers with colPos values 201 and 202 for the two column container, and 201, 202, and 203 for the three columns containers seems to make the most sense since editors can use the containers and switch between the different configurations without having to rearrange all content elements already saved into one of the first two columns.
If I set names like 201 => left, 202 => right for the two column container, and 201 => left, 202 => middle, 203 => right for the three column container one of the following is happening:
Either the two column element has column names in the backend of "left" and "middle" (instead of "left" and "right"), or the three column element has column names of "left", "right" and "right".
I can fix this by applying pageTSconfig or using columnsOverride configuration (not tested) but it would make more sense to have that solved on registering a container cType.
Hello,
in case of extending Container class it would be nice, if you instantiate classes with GeneralUtility::makeInstances instead of new
.
Stefan
have a container with a translation and a child without translation. Edit child, and try to create new translation throws Exception
It would be nice to have setters for all properties of ContainerConfiguration
.
Currently I need to do something like this
$container = new \B13\Container\Tca\ContainerConfiguration(
'container-tabs',
'Tab Container',
'Container Element mit Tabs',
[
[
[
'name' => 'Inhalt',
'colPos' => 201
]
]
],
);
$container->setIcon('container-tabs');
but I am really bad with those big constructur injections.
So I would prefer something
$container = new \B13\Container\Tca\ContainerConfiguration('container-tabs);
$container->setTitle('Tab Container');
...
The header field should be shown as it might be useful for styling but more important not showing it can lead so something like this
having a (copy 1)
label which can't be really edited by editors (at least in page module)
what about using something like in HTML element with a label Name (not visible in frontend)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.