blog.Resource
December 11, 2014

Something Neos VIII - I choose you

Category: Florian Weiss, TYPO3

By: Florian Weiss

Choosing which elements editors are able to add with constraints

TYPO3 NEOS 1.2 released

Important things first - our new beloved CMS has a new release.
If you haven't done so yet I'd recommend grabbing TYPO3 NEOS 1.2  immedately, as the new features are surely something to talk about. (which surprisingly we will do in a moment)

If you upgrade from TYPO3 NEOS 1.1 - be sure to check out the upgrade instructions.

The update itself went very smooth on my test server (the live one at my shared hoster is unfortunately down due to technical problems at the moment), but there are some hints that might be of interest to you:

  • update composer first via: composer selfupdate
    • not a big deal if you don't, just good practice to stay on the current release
  • if you tampered with the original files (I myself did that by accident adding a blank in a core file) you'll be asked if you want to discard the changes - I guess you want to (no need for that extra blank).
    In case you accidentaly pressed "no" - no worries - just rerun the same command and choose "yes" this time.
    (In the occasion where you made changes to the core you want to merge with your installation this listpoint won't give you new insight anyways, as you might not have wondered what the prompt is for)
  • Google Chrome refused to show the inspector content when first loading the backend for my updated installation - clearing the caches of the browser solved that (FF and IE worked out of the box without clearing)
  • If you want to confirm your new version after the installation you can run:
    composer -i show
    (thx soee of #typo3-neos on freenode.net)

checking the NEOS version

Don't forget to check out the Release notes too!

Select your players

So now that we have NEOS 1.2 installed and running - you expect me to show off some of the new awesomeness do you? Well let's do this then:

Something I always hoped for while doing while developing content elements was the possibility to restrict what editors can select as content elements inside a content collection.

Imagine you have a space on your site dedicated to videos. It would be nice if we could restrict editors to adding videos there instead of having them go wild with 3-column content containing images, headers and text.
Well as you might have imagined: now we can.

Example:
The MediaList element for the Weissheiten.Neos.Bootstrap package should (what a surprise) only contain elements of the type: 'Weissheiten.Neos.Bootstrap:Media'.

This can conveniently be achieved via editing the NodeType definition in NodeTypes.yaml now:

 The only new part is the "constraints" section - we disallow ALL content elements and afterwards overwrite the settings with the allowed ones.

Upload your altered file with restrictions in place (I prefer to run a ./flow configuration:validate --NodeTypes before checking or altering the site), clear the cache (./flow flow:cache:flush) and you are good to go.

For more info on constraints check out the Node Type Constraints section in the manual.

The Weissheiten bootstrap package will be adapted as soon as time allows it to take advantage of the new features.

Happy coding and a big thank you to the whole TYPO3 NEOS team for getting the new version out.

 

 


comments

No comments yet. Be the first to comment on this!

Sorry, comments are closed for this post.