Code Monkey home page Code Monkey logo

content-blocks's People

Contributors

ckussin avatar danielsiepmann avatar garvinhicking avatar jonaseberle avatar krausandre avatar linawolf avatar luko72 avatar manus3009 avatar nhovratov avatar peterkraume avatar pkuhlmay avatar sbuerk avatar thommyhh avatar typecat avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

content-blocks's Issues

indentation in Documentation is wrong for advanced example for type number

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.

Automatically create custom groups

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.

CLI command should be content-block:make and not make:content-block

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.
Bildschirmfoto 2023-11-10 um 21 02 49

directory "config" a mistake?

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

Extension not installable in non composer installations

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.

Custom ResourceViewHelper

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.

Singular for generated directories

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 ^^

Path for Partials is wrong

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.

Strengthen make:content-block and provide guidelines

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.

grafik

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

command 'make' should ask for content element name instead of package name

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.

$questionPackage = new Question('Enter your package name: ');

[FEATURE] Provide a integrity check possibility (cli command, ...)

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.

Documentation for Checkbox has no info about cols and renderType

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.

dropdown for color is always the default value

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:
Bildschirmfoto 2023-06-27 um 21 12 35

I expected, that my select color will be the selected one inside the dropdown.

[FEATURE] Override/extend existing content elements/records

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'

Textfield is not a valid type

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

Add custom typoscript to Content-Block

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.

Prebuild Icon.svg for page type is cut off inside page tree

The Icon which is prebuild for the new created page type is a little bit cut of inside the page tree.

This icon is in the top bar above the page tree:
Bildschirmfoto 2023-11-10 um 21 06 45
This is in the page tree:
Bildschirmfoto 2023-11-10 um 21 06 50

I am not sure if it is related to CB or if it is a core bug.

Cant change icon when creating contentelement with skeleton command

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.

Make it possible to use custom icons for collections

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:

  • identifier: collection
    type: Collection
    image: collection-xy.svg
    fields:
    • identifier: text
      type: Text

And then the image is under collection/Assets/collection-xy.svg

Currently my collection looks like this:
Bildschirmfoto 2023-07-03 um 17 22 05

DateTime with an upper range always shows validation error

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'

Bildschirmfoto 2023-07-03 um 19 40 45

Bildschirmfoto 2023-07-03 um 19 39 15

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

[FEATURE] Add option to prefix fields with vendor name only

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

MariaDB Exception creating record-type

Steps to reproduce:

  • create new record-type with make:content-block
  • name should be test-slides
  • run "Analyse Databse Structure" and then "Apply selected changes" in TYPO3 Backend

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"

Warning using commandline

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'

make:content_block results to an error: No packages found ....

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?

Collection with foreign table ist not working

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

Multiple fields of type Collection in single Content Block not possible

If I am creating multiple collection fields in a single Content Block, i only get the data from the first collection field. The remaining collection fields only return an integer value containing the count of the items i put in and not an array with the data.

// EditorInterface.yaml:

editorInterface

// Output:

output

PageType -> image -> enableImageManipulation has no effect

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:

Bildschirmfoto 2023-11-10 um 21 18 56

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.

[DISCUSSION] Should the SEO tab be visible by default for new page types?

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).

prefixType not working like described in documentation

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

[FEATURE] Bundle AssetCollector CSS files

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)

Cannot use global partial in Content Block with f:render

If i try to use a global Partial from the "packages/extension/Resources/Private/Partials/Page" directory, i get the following error:

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?

Localizable items for select, check and radio

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. :-)

Suggestion: use the identifier for the label of the content block

Inside

<source>Content Block title</source>

it would be more readable if you use the $identifier for the label instead of the word "title".
If you create more content blocks (without changing the Labels.xlf file) you get a lot of content blocks, all with the same name. When using the identifier, you get content blocks with the label "Content Block: category" for example. This is more readable in the backend while adding content elements with the content element wizard.

Bildschirmfoto 2023-07-03 um 16 39 46

Fill EditorPreview + Frontend with some data

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.