nhovratov / content-blocks Goto Github PK
View Code? Open in Web Editor NEWTYPO3 CMS Content Blocks - Content Types API
Home Page: https://docs.typo3.org/p/contentblocks/content-blocks/main/en-us/
License: GNU General Public License v2.0
TYPO3 CMS Content Blocks - Content Types API
Home Page: https://docs.typo3.org/p/contentblocks/content-blocks/main/en-us/
License: GNU General Public License v2.0
Inside the advanced example the indentation is wrong. With the given example I couldn't get the slider working.
It could be
name: treupo/number
group: contentblocks
prefixFields: false
fields:
- identifier: number
type: Number
format: integer
default: 10
size: 20
range:
lower: 10
upper: 999
slider:
range:
step: 10
width: 100
valuePicker:
items:
[
[ '100', 100 ],
[ '250', 250 ],
[ '500', 500 ],
]
In my case the step inside the range is not working. I expected to set the slider with steps of 10. But the step is still 1.
You can group all your content blocks in separate groups, not only the group "common". In the documentation, I couldn't find anything on how to add a custom group to my TYPO3 installation.
I know this is a core feature and has nothing to do with the content blocks. But I suggest adding a little code snippet to the documentation which shows how to add custom groups.
Like:
mod.wizards {
newContentElement.wizardItems {
mygroup.header = Content blocks (Maybe with the LLL:EXT syntax)
}
}
This would help other developers who don't really know how to add this group to their sitepackage.
Hi at the moment, the CLI for creating a content block is make:content-block
. When looking at the other CLI commands, everyone starts with the extension (or the scope for which it is written) and then the specific command. Like install:setup
, database:updateschema, scheduler:run.
So i suggest renaming the CLI command, so the scope is named first (content-block or content-blocks) and then the specific command (make). So when you have to add some more commands, like update, remove or something else, it would be content-block:update
, content-block:remove
. So all the commands for CB are listed in the same area and not under update, remove or make.
I don't know from reading why there is this config directory inside the root of the extension? if this is for testing, maybe this should be copied using a composer post-autoload-dump
command to copy it from the build directory but by default it feels very wrong seeing this dir
Installation fails for me in a 12.4.6 TYPO3 installation with only EXT:container and my provider extension installed besides. The error message is:
"Expected to find class "TYPO3\CMS\ContentBlocks\Backend\Preview\PreviewRenderer" in file "/.../typo3conf/ext/content_blocks/Classes/Backend/Preview/PreviewRenderer.php" while importing services from resource "../Classes/*", but it was not found! Check the namespace prefix used with the resource."
The file exists in this path. Without investigating further, I would guess that TYPO3 core in non composer installations has a class loading problem with the TYPO3\CMS vendorname in a non system extension.
This might be a not necessary, nice to have feature or maybe there's another solution for this I didn't realized yet. If so, please let me know. ;)
Regardless of this it would just add a small portion of convenience imo.
To the point: beside JS and CSS files sometimes we might want to access other Assets like e.g. icons within our views.
My idea was, even if the path to the public assets is not cryptic and predictable, maybe it could be a nice addition to allow easy access to this path. I know, it's just the combination of two static strings (_assets and cb) and the name of the content block including it's vendor, I thought it might be nice to not combine this parts manually every time.
Not sure if a custom uri.resource-ViewHelper should be the solution or if a simple method inside the ContentBlockData object returning the path as a string would be enough.
The second would be very easy to implement as the name of the block including the vendor is part of the object anyway.
If you think this mini feature is worth it to be implemented, please let me know and I could prepare a PR for it.
while watching the presentation at mtug I suggest to rename generated directory name PageTypes
to PageType
and ContentElements´ to
ContentElements`
Take a look at other directories Resource
, Controller
, Language
, Configuration
I know ViewHelpers
is kind of different ^^
\TYPO3\CMS\ContentBlocks\Command\PackageResolver
is no command, should be moved to a Service directory but not inside command
Hi,
I tried to use a partial inside my html template. In the frontend I got the message:
The Fluid template files "SITEPACKAGE/ContentBlocks/ContentElements/headline/Source/PartialsHeader/Header.html", "SITEPACKAGE/ContentBlocks/ContentElements/headline/Source/PartialsHeader/Header" could not be loaded.
There is an /
missing between Partials and the first "Header" -> Source/PartialsHeader/Header
When I add the Folder Source/Partials
I don't get this issue any more.
It only occurs when the Partials Folder is missing.
The message itself is correct, only the missing /
is not correct.
Hello @nhovratov,
I took my first round with EXT:content-blocks and my first impression is positive!
When creating new content elements with the make
command I saw that it is possible to create content blocks with whitespaces which also leads to whitespaces in folder names too. On this step I didn't know if it asks for the technical or the content element name for editors.
For me it was unclear if I should use lowerCamelCase or hyphens to give the content blocks a name. I needed to take a look into the docs and the examples. My lowerCamelCase pageTeaser
gets processed to lowercase only pageteaser
.
Maybe you can add some guidelines in the make
command or also strip of whitespaces to strengthen the create process.
Thanks in advance!
Daniel
When creating a new content block with help of the command make
the user will be asked for a package name.
This is a relic from the days when content blocks were composer packages.
I suggest renaming it to "content element name" or "name of your content element" or just "name of CE" or "identifier" or something else. Because this will be the identifier of the content element and not the name of the package.
Fields can be reused, either by using the useExistingField
option
or if prefix: false
is used.
However, if two content blocks are defining incompatible field types
for a fieldname, this is not a proplem TCA or form-engine spoken. But
also ext_tables.sql
structures are added using a hook. How would this
end up ?
For example, having for a field some_field
a TCA Type check
and for
another block TCA Type select
with text values, that won't really
match. Who will win for the schema generation ?
Therfore, at least a cli command
needs to be added to make a integrity
check in some way. contentblocks:integrity-check
. Not sure, maybe this
can also start as a dedicated core command in ext:core
with some events,
so content-block can provide custom checks to add/termine differences in
some way. Or at least start for content blocks.
This should be at least considert in the one or other way mid-term.
The documentation for the Checkbox has some information about the properties default
and items
, but no one for cols
and renderType
.
For cols
you could describe, that this is the number of cols, in which the checkboxes will be displayed. This is not obvious to everybody.
For renderType
you could list all the available renderTypes which are shipped by the core. See: https://docs.typo3.org/m/typo3/reference-tca/main/en-us/ColumnsConfig/Type/Check/Index.html#columns-check
BTW I get an error when using the checkboxLabeledToggle
:
PHP Warning: Undefined array key 0 in /var/www/html/vendor/typo3/cms-backend/Classes/Form/Element/CheckboxLabeledToggleElement.php line 176
This comes from the core but I am not sure yet if it is related to content blocks.
If checkboxLabeledToggle doesn't work with content blocks yet, the documentation should also list this value as not allowed.
Instead these should be published on Composer build time, just like TYPO3 solves this.
Additionally, for Windows support, on Windows junctions should be created instead of Symlinks.
I created a contend block which has the following settings:
name: treupo/color
group: contentblocks
prefixFields: false
fields:
- identifier: color
type: Color
- identifier: colortwo
type: Color
autocomplete: true
default: '#0000FF'
valuePicker:
items:
[
[ 'Red', '#FF0000' ],
[ 'Green', '#008000' ],
[ 'Blue', '#0000FF' ],
]
When I edit the element in the backend and select one of the colors and then open the dropdown again, the selected color is always the one without a value:
I expected, that my select color will be the selected one inside the dropdown.
It would be nice to be able to extend existing records (pages, tt_content, ...) with new fields using the YAML syntax of the content_blocks
extension.
I would suggest a folder structure like ContentBlocks/Overrides/{ContentElements,PageTypes,RecordTypes}
similar to the Configuration/TCA/Overrides
folder used by the TYPO3 Core.
If the table to be overridden does not exist - in case of RecordTypes
- an exception should be thrown to make it clear, that there is an error.
The YAML syntax could look like this:
name: t3core/1 # this should override doktype = 1; t3core as vendor prefix indicates, that this is a core type, which does not have a prefix in the TCA
fields:
# Adds new field after the field `seo_title`
- identifier: my_special_field
type: Textarea
enableRichtext: true
after: seo_title # Can be either a field or `palette:{name_of_palette}`
linebreak: 'before' # Could be `before`, `after` or `both` to insert additional line break before and/or after the field we add
# Adds new field before the field `description`
- identifier: my_other_field
type: Link
before: description # Can be either a field or `palette:{name_of_palette}`
linebreak: 'after' # Could be `before`, `after` or `both` to insert additional line break before and/or after the field we add
# Adds new tab at the end
- identifier: settings_tab
type: Tab
fields:
- identifier: header_menu_pages
type: Relation
allowed: pages
# It is also possible to add a tab after field or palette like with a single field. The new tab is inserted after the tab, the given field or palette is located in
after: no_follow # Field identifier or `palette:<name-of-palette>`
Another feature could be to make it possible to override existing fields, e.g. to assign a new label, change the configuration or move the field to another tab or palette. However, the type must not change, to avoid issues the underlying database field.
name: t3core/1 # this should override doktype = 1; t3core as vendor prefix indicates, that this is a core type, which does not have a prefix in the TCA
fields:
# This would throw an exception "You must not change the type of an existing field. Do not use `useExistingField` and `type` together."
- identifier: keywords
useExistingField: true
type: Textarea
after: description
linebreak: 'before'
# Move the field after the `description` field in the `SEO` tab
- identifier: abstract
useExistingField: true
after: description
linebreak: 'before'
seeing your presentation and the exception if a type is wrong: an exception should also help the user by providing all valid types as list
Supply a way to enrich content-blocks with custom typoscript Rendering, e.g. DataProcessors like Menu. This should happen in the folder of the specific content-block to maintain the easyness of copying the blocks.
Hey,
i encounter a cache bug where I cant change the default icon after creating a contentelement skeleton with the make:content-block
command.
Tried ddev typo3 cache:flush -g system
, ddev typo3 cache:flush
, the lightning icon in the backend, flush cache via maintance module and tried to remove temporary assets (if existing) there too, but nothing seems to work.
If I open the symlinked public path to the icon (https://content-blocks.ddev.site/_assets/cb/myvendor/myelement/Icon.svg) and make a hard refresh in the browser and go through the steps again it works sometimes in the page and detail view but never in the contentelement create wizard.
Unfortunately i currently couldnt reproduce it more reliable.
Issue arises in clone of this repo and also on a v12.4.6 composer test site.
TYPO3 Core seems to use xliff version 1.2
(https://docs.typo3.org/m/typo3/reference-coreapi/main/en-us/ApiOverview/Localization/XliffFormat.html).
The generated Labels.xlf is using version 1.0.
Is there a reason why this version is used?
And would it be an advantage to change to the same standard as the TYPO3 core?
see https://github.com/georgringer/typo3-json-schemas and the final PR SchemaStore/schemastore#2524
I suggest not add a PR once all configurations are final and use a custom import of the schema until then
Currently a collection uses the icon Extension.svg
. It would be great if I could use my own icons for a collection.
Maybe I could edit the yml like this:
name: treupo/collection
group: treupo
prefixFields: true
fields:
And then the image is under collection/Assets/collection-xy.svg
I have a DateTime field with an upper range. No matter what I input, I always get a validation error with "max".
Configuration:
name: treupo/datetime
group: treupo
prefixFields: true
fields:
- identifier: max
type: DateTime
default: '12:00 2023-02-11'
range:
lower: '12:00 2022-01-01'
upper: '12:00 2050-12-31'
TYPO3 12.4.2
CB: dev-main
Note: I switched the notation inside the lower and upper definition. The input field stores the datetime with HH:MM YYYY-MM-DD, inside the example in the CB documentation there is: YYYY-MM-DD HH:MM:SS
The basic "TYPO3/Seo" seems not to be documented at the moment: https://docs.typo3.org/p/contentblocks/content-blocks/main/en-us/IntegratorManual/Basics/Index.html
This basic is already in version 0.1.6, I tried it and it worked.
Only these are documented:
TYPO3/Appearance
TYPO3/Links
TYPO3/Categories
There might be others which are not documented but already shipped with the extension.
You can provide your own croppings for CTypes via TCA/Overrides.
It would be great if these could also be defined in the YAML file "EditorInterface.yaml".
The advantage would be that the configuration required for the image elements is also supplied with the "Content Blocks".
As part of the first real-life project with Content Blocks , I quickly came to the point where I created new fields for content elements that I would like to use across several content elements (e.g. a dropdown for selecting icons).
In general I like the concept of a prefix on fields in order to maintain a clear overview of where fields belong to and to avoid conflicts in principle resp. to minimize the chance of those.
This gave me the idea and question of whether an option "prefixWithVendorNameOnly" could be useful in addition to the existing prefixFields option, so that you don't have to prefix each field manually while still have a uniform prefix for all fields within a vendor.
Just an idea, maybe totally nonsense on closer examination, but I still wanted to at least throw the idea out there, in case I'm not the only one who sees this as a useful feature. Maybe there's another, better way to handle these use-cases. If so, please let me know. If so I could also help with some documentation for it, if missing.
As always: don't hesitate to give me a ping if you've further questions or I can help with implementing the feature if it comes into consideration.
Best regards,
Marcel
Steps to reproduce:
This will lead to
Error: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '-slides (
uidINT UNSIGNED AUTO_INCREMENT NOT NULL,
pidINT
Reason is the generated table name "tx_vendorname_domain_model_test-slides" in EditorInterface.yaml
It should be "tx_vendorname_domain_model_test_slides"
vendor/bin/typo3 make:content-block
brings up a notice warning
PHP Warning: Undefined array key "georg.ringer/t3-12" in /var/www/html/vendor/contentblock
s/content-blocks/Classes/Command/PackageResolver.php line 72
my root composer.json starts like that
{
"name": "georg.ringer/t3-12",
"type": "project",
"repositories": {
"0": {
"type": "path",
"url": "./packages/*"
}
},
it seems it is enough to change the line to that
fn (PackageInterface $package): bool => ($composerLockMap[$package->getValueFromComposerManifest('name')] ?? null) === 'path'
Hi I tried to test the EXT:content-blocks. Everything worked fine, but I get an error when I use the CLI command make:content-block
.
"No packages were found in which to store the content block."
I am using it with ddev. Just cloned the repo and ddev start
.
Is there a special folder structure in which the extension tries to put the new content block in?
Regarding the advanced example for collection in the documentation
# This custom table needs to be defined in a separate Content Block
name: example/slide
table: my_slide
aggregateRoot: false
fields:
- identifier: image
type: File
name: example/collection
group: common
fields:
- identifier: slides
type: Collection
foreign_table: my_slide
This is not working. You will get an exception in backend page module and in frontend after creating the content element:
(1/1) #1628925803 OutOfBoundsException
The table "example_collection_slides" does not exist.
You can create the example_collection in the list module and its irrre elements are stored correct in my_slide table.
Maybe the configuration in EditorInterface.yaml is wrong
documentation in readme should be linked to https://docs.typo3.org/c/contentblocks/content-blocks/main/en-us/Index.html
I have a custom page type which has an image for which I wanted to disable the image manipulation.
I first set it to true, this worked. Then I set it to false, cleared all the caches and reloaded the page. I still have the possibility to manipulate the image:
My configuration is this:
name: treupo/testing
typeName: 3987
prefixFields: true
fields:
- identifier: image
type: File
enableImageManipulation: false
maxitems: 5
minitems: 3
allowed: common-image-types
It doesn't care which configuration I use, neither true nor false is working. Even if I remove the line for enableImageManipulation doesn't work. According to the documentation at https://docs.typo3.org/p/contentblocks/content-blocks/main/en-us/IntegratorManual/YamlReference/FieldTypes/File/Index.html#confval-enableImageManipulation the default value is false
I also created a whole new page type with an image without the line enableImageManipulation
, it still was there.
Provide a file .gitattributes with content like in https://github.com/georgringer/news/blob/main/.gitattributes
those directories/files are excluded when extension is installed with prefered dist (default), so no test, build, dev stuff is packaged
// ext_tables.sql
CREATE TABLE `tt_content` (
`foreign_table_parent_uid` int(11) DEFAULT '0' NOT NULL,
`tablenames` varchar(255) DEFAULT '' NOT NULL,
`fieldname` varchar(255) DEFAULT '' NOT NULL,
KEY parent_uid (foreign_table_parent_uid)
);
Hi I created a new page-type and at first I was wondering where the SEO-Tab is.
I could add it very fast with the basic "TYPO3/Seo" (btw this basic is not documented yet, I will creat another issue)
But .....
we need to discuss whether we should add the SEO tab by default or not. There are some other tabs which are (in my opinion) much less important than the SEO tab (like Notes-Tab).
I understand, that when somebody creates a new page type, he might not want to have all the tabs (because maybe that is why he wanted to create his own page type). But in my case I only wanted to have some more options for a page, like background_color. In my case I added the SEO tab with the basics so the user can change these fields.
I think we should add either all tabs, which are already in the "standard" page (doktype 1?) or none of them (and then the integrator/developer must add them with the basics). For me it didn't make any sense as I realized that the SEO Tab is missing (which is important for pages for SEO) and the Notes-Tab is there (which I have never used before).
In Typo3 112.4.7 and Content-Blocks 0.1.6, define 2 content-blocks:
name: ab/ce1
group: common
prefixFields: true
prefixType: vendor
fields:
-
identifier: select
type: Select
name: ab/ce2
group: common
prefixFields: true
prefixType: vendor
fields:
-
identifier: select
type: Select
flush caches in install-tool
run db-analyser.
result:
Add fields to tables
ALTER TABLE `tt_content` ADD `ab_ce1_select` VARCHAR(255) DEFAULT '' NOT NULL
ALTER TABLE `tt_content` ADD `ab_ce2_select` VARCHAR(255) DEFAULT '' NOT NULL
expected result:
Add fields to tables
ALTER TABLE `tt_content` ADD `ab_select` VARCHAR(255) DEFAULT '' NOT NULL
Theoretically it could/should be possible via an AssetCollector "writeJavascriptToTemporaryFile" (within Core) to bundle all generated assets instead of having individual CSS HTTP requests.
(I'll offer to look into this, just wanted to write this down)
The items
inside this yaml:
If i try to use a global Partial from the "packages/extension/Resources/Private/Partials/Page" directory, i get the following error:
I am trying to implement the partial with the following code:
<f:render section="ShoppingCart" partial="ShoppingCart" arguments="{_all}" />
Is there a way to achieve my goal?
As every Content Block comes with its own locallang-file, maybe it would be nice to provide a shorter syntax to access language keys within the XLIFF-files of the own content block?
Would be TBD how this could look like without building a maybe confusing, isolated solution which only works for Content Blocks but anywhere else. Especially thinking about TYPO3 newcomers here.
If you think it's nevertheless worth it to think further about implement a solution for this, don't hesitate to let me know. :-)
There seems to be a wrong type
inside an example in the documentation.
According to the available types, Image should not be possible. It also throws an error
"Image" is not a valid backing value for enum "TYPO3\CMS\ContentBlocks\Enumeration\FieldType"
Should it be File
instead? It's not only the mentioned line, there are more.
This is easier to implement in TYPO3 v13, as SQL columns can be generated from TCA there.
Inside
by default, at least the header should be rendered + some dummy content like "this is the template of the xyz element"
why? because this makes it so much easier to find the correct template to change by just searching for the static content
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.