2017 © Pedro Peláez
 

typo3-cms-extension typo3api

image

nemo64/typo3api

  • Monday, July 30, 2018
  • by Nemo641
  • Repository
  • 1 Watchers
  • 0 Stars
  • 1,685 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 16 Open issues
  • 21 Versions
  • 35 % Grown

The README.md

Latest Stable Version Total Downloads Monthly Downloads License, (*1)

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., (*2)

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., (*3)

how to use

Replace your TCA array with the Typo3Api\Builder\TableBuilder., (*4)

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., (*5)

\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., (*6)

ContentElement

To Create a content element, use the TableBuilder inside Configuration/TCA/Override/tt_content.php., (*7)

\Typo3Api\Builder\TableBuilder::create('tt_content', 'carousel')
    ->configure(new \Typo3Api\Tca\ContentElementConfiguration())
    // add more fields as you like
;

Or with more options., (*8)

\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, (*9)

The Versions

15/03 2018
26/01 2018

v1.1.9

1.1.9.0

  Sources   Download

MIT

The Requires

 

The Development Requires

api typo3 tsconfig tca ext_tables.php ext_localconf.php

21/11 2017

v1.1.8

1.1.8.0

  Sources   Download

MIT

The Requires

 

The Development Requires

api typo3 tsconfig tca ext_tables.php ext_localconf.php