infabo / typo3api
Installs: 2 255
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 6
Open Issues: 2
Type:typo3-cms-extension
Requires
- php: ^8.1
- symfony/intl: ^5 || ^6
- symfony/options-resolver: ^5 || ^6
- symfony/polyfill-mbstring: ^1
- symfony/polyfill-php80: ^1.23.0
- typo3/cms-backend: ^12.4
- typo3/cms-core: ^12.4
- typo3/cms-extbase: ^12.4
- typo3/cms-frontend: ^12.4
- typo3/cms-install: ^12.4
- typo3/cms-lang: ^12.4
Requires (Dev)
- friendsoftypo3/phpstan-typo3: ^0.9.0
- ssch/typo3-rector: ^1.1
- symplify/easy-coding-standard: ^11
- typo3/testing-framework: ^6.16.6
- dev-master
- 4.0.0-rc.9
- 4.0.0-rc.8
- 4.0.0-rc.7
- 4.0.0-rc.6
- 4.0.0-rc.2
- 4.0.0-rc.1
- 3.2.12
- 3.2.11
- 3.2.10
- 3.2.9
- 3.2.8
- 3.2.7
- 3.2.6
- 3.2.5
- 3.2.4
- 3.2.3
- 3.2.2
- 3.2.1
- 3.2.0
- 3.1.1
- 3.1.0
- 3.0.2
- 3.0.1
- 3.0.0
- v2.0.1
- v2.0.0
- v2.0.0-RC1
- v1.3.0
- v1.2.0
- v1.1.10
- v1.1.9
- v1.1.8
- v1.1.7
- v1.1.6
- v1.1.5
- v1.1.4
- v1.1.3
- v1.1.2
- v1.1.1
- 1.1.0
- v1.0.2
- v1.0.1
- v1.0.0
- dev-feature/easy-inline-relation
- dev-v2-dev
This package is auto-updated.
Last update: 2024-11-07 09:36:46 UTC
README
API for easier TYPO3 TCA handling
This extension abstracts some of the array configuration necessary to get things done in TYPO3. This will result in faster, easier and less annoying workflows.
how to install
Use composer require infabo/typo3api
to install this extension. For anyone not using composer: make your project use composer first. Seriously, this extension is to ease your workflow but if you are still using the none-composer mode you have bigger workflow problems.
how to use
Replace your TCA array with the Typo3Api\Builder\TableBuilder
.
TableBuilder
Create the TCA file in your extension like Configuration/TCA/tx_ext_person.php
.
Then, instead of returning the TCA array, you can use the TableBuilder.
\Typo3Api\Builder\TableBuilder::create('tx_ext_person') ->configure(new \Typo3Api\Tca\LanguageConfiguration()) ->configure(new \Typo3Api\Tca\EnableColumnsConfiguration()) ->configure(new \Typo3Api\Tca\SortingConfiguration()) // configure cache clearing so you don't need to provide cache clear capabilities to your backend users ->configure(new \Typo3Api\Tca\CacheTagConfiguration('tx_ext_person_###UID###')) ->configure(new \Typo3Api\Tca\CacheTagConfiguration('tx_ext_person')) // the actual fields ->configure(new \Typo3Api\Tca\Field\InputField('first_name', ['required' => true, 'localize' => false])) ->configure(new \Typo3Api\Tca\Field\InputField('last_name', ['required' => true, 'localize' => false])) ->configure(new \Typo3Api\Tca\Field\DateField('birthday')) ->configure(new \Typo3Api\Tca\Field\EmailField('email')) ->configure(new \Typo3Api\Tca\Field\ImageField('image', ['cropVariants' => ['default' => ['1:1']]])) // easily allow multiple phone numbers ->configure(new \Typo3Api\Tca\Field\InlineRelationField('phone_numbers', [ 'foreign_table' => \Typo3Api\Builder\TableBuilder::create('tx_ext_person_phone') ->configure(new \Typo3Api\Tca\SortingConfiguration()) ->configure(new \Typo3Api\Tca\Field\SelectField('type', ['values' => ['business', 'private', 'other']])) ->configure(new \Typo3Api\Tca\Field\PhoneField('value')) ])) // use or create complex configurations and reuse them across tables ->configure(new \Typo3Api\Tca\Util\Address('Address')) // create new tabs (aka --div--) on the fly ->configureInTab('Notice', new \Typo3Api\Tca\Field\TextareaField('notice')) ;
That is all. You can now start using the tx_ext_person table.
ContentElement
To Create a content element, use the TableBuilder inside Configuration/TCA/Override/tt_content.php
.
\Typo3Api\Builder\TableBuilder::create('tt_content', 'carousel') ->configure(new \Typo3Api\Tca\ContentElementConfiguration()) // add more fields as you like ;
Or with more options.
\Typo3Api\Builder\TableBuilder::create('tt_content', 'quote') ->configure(new \Typo3Api\Tca\ContentElementConfiguration([ 'name' => 'Quote element', 'description' => 'Tell what other peaple are saying', 'icon' => 'content-quote', 'headline' => 'hidden', // adds only the headline field ])) ;
run the unit tests
run vendor/bin/phpunit