<?php

// Make sure that we are executed only from the inside of TYPO3
if (!defined('TYPO3_MODE')) {
    die('Access denied.');
}
// Prepare new columns for be_users table
$tempColumns = array('tx_openid_openid' => array('exclude' => 0, 'label' => 'LLL:EXT:openid/locallang_db.xml:be_users.tx_openid_openid', 'config' => array('type' => 'input', 'size' => '30', 'eval' => 'trim,nospace,unique')));
// Add new columns to be_users table
t3lib_div::loadTCA('be_users');
t3lib_extMgm::addTCAcolumns('be_users', $tempColumns, false);
t3lib_extMgm::addToAllTCAtypes('be_users', 'tx_openid_openid;;;;1-1-1', '', 'after:username');
t3lib_extMgm::addLLrefForTCAdescr('be_users', 'EXT:' . $_EXTKEY . '/locallang_csh.xml');
// Prepare new columns for fe_users table
$tempColumns['tx_openid_openid']['config']['eval'] = 'trim,nospace,uniqueInPid';
// Add new columns to fe_users table
t3lib_div::loadTCA('fe_users');
t3lib_extMgm::addTCAcolumns('fe_users', $tempColumns, false);
t3lib_extMgm::addFieldsToAllPalettesOfField('fe_users', 'username', 'tx_openid_openid');
t3lib_extMgm::addLLrefForTCAdescr('fe_users', 'EXT:' . $_EXTKEY . '/locallang_csh.xml');
// Add field to setup module
$GLOBALS['TYPO3_USER_SETTINGS']['columns']['tx_openid_openid'] = array('type' => 'user', 'table' => 'be_users', 'label' => 'LLL:EXT:openid/locallang_db.xml:_MOD_user_setup.tx_openid_openid', 'csh' => 'tx_openid_openid', 'userFunc' => 'EXT:openid/class.tx_openid_mod_setup.php:tx_openid_mod_setup->renderOpenID', 'access' => 'tx_openid_mod_setup');
t3lib_extMgm::addFieldsToUserSettings('tx_openid_openid', 'after:password2');
t3lib_extMgm::addLLrefForTCAdescr('_MOD_user_setup', 'EXT:openid/locallang_csh_mod.xml');
Example #2
0
	Extend existing tables
-------------------------------------------------- */
$tempColumns = array('tx_odsosm_lon' => array('exclude' => 1, 'label' => 'LLL:EXT:ods_osm/locallang_db.xml:tx_odsosm_lon', 'config' => array('type' => 'input', 'size' => 11, 'max' => 11, 'checkbox' => '0.000000', 'default' => '0.000000', 'eval' => 'tx_lonlat', 'wizards' => array('_PADDING' => 2, '0' => array('type' => 'popup', 'title' => 'Search coordinates', 'script' => 'EXT:ods_osm/wizard/index.php', 'icon' => 'EXT:ods_osm/wizard/osm.png', 'JSopenParams' => ',width=600,height=400,status=0,menubar=0,scrollbars=0')))), 'tx_odsosm_lat' => array('exclude' => 1, 'label' => 'LLL:EXT:ods_osm/locallang_db.xml:tx_odsosm_lat', 'config' => array('type' => 'input', 'size' => 10, 'max' => 10, 'eval' => 'tx_lonlat')));
t3lib_div::loadTCA('fe_users');
t3lib_extMgm::addTCAcolumns('fe_users', $tempColumns, 1);
if (t3lib_div::compat_version('4.3')) {
    t3lib_extMgm::addToAllTCAtypes('fe_users', 'tx_odsosm_lon', '', 'after:country');
    t3lib_extMgm::addFieldsToAllPalettesOfField('fe_users', 'tx_odsosm_lon', 'tx_odsosm_lat');
} else {
    t3lib_extMgm::addToAllTCAtypes('fe_users', 'tx_odsosm_lon, tx_odsosm_lat', '', 'after:country');
}
t3lib_div::loadTCA('tt_address');
t3lib_extMgm::addTCAcolumns('tt_address', $tempColumns, 1);
if (t3lib_div::compat_version('4.3')) {
    t3lib_extMgm::addToAllTCAtypes('tt_address', 'tx_odsosm_lon', '', 'after:city');
    t3lib_extMgm::addFieldsToAllPalettesOfField('tt_address', 'tx_odsosm_lon', 'tx_odsosm_lat');
} else {
    t3lib_extMgm::addToAllTCAtypes('tt_address', 'tx_odsosm_lon, tx_odsosm_lat', '', 'after:city');
}
$tempColumns = array('tx_odsosm_marker' => array('exclude' => 1, 'label' => 'LLL:EXT:ods_osm/locallang_db.xml:tt_address_group.tx_odsosm_marker', 'config' => array('type' => 'group', 'internal_type' => 'db', 'allowed' => 'tx_odsosm_marker', 'size' => 1, 'minitems' => 0, 'maxitems' => 1)));
t3lib_div::loadTCA('fe_groups');
t3lib_extMgm::addTCAcolumns('fe_groups', $tempColumns, 1);
t3lib_extMgm::addToAllTCAtypes('fe_groups', 'tx_odsosm_marker;;;;1-1-1');
t3lib_div::loadTCA('tt_address_group');
t3lib_extMgm::addTCAcolumns('tt_address_group', $tempColumns, 1);
t3lib_extMgm::addToAllTCAtypes('tt_address_group', 'tx_odsosm_marker;;;;1-1-1');
/* --------------------------------------------------
	New tables
-------------------------------------------------- */
$TCA['tx_odsosm_geocache'] = array('ctrl' => array('title' => 'LLL:EXT:ods_osm/locallang_db.xml:tx_odsosm_geocache', 'label' => 'zip', 'tstamp' => 'tstamp', 'crdate' => 'crdate', 'cruser_id' => '', 'default_sortby' => 'ORDER BY zip', 'delete' => 'deleted', 'rootLevel' => 1, 'dynamicConfigFile' => t3lib_extMgm::extPath($_EXTKEY) . 'tca.php', 'iconfile' => t3lib_extMgm::extRelPath($_EXTKEY) . 'icon_tx_odsosm_geocache.png'));
$TCA['tx_odsosm_layer'] = array('ctrl' => array('title' => 'LLL:EXT:ods_osm/locallang_db.xml:tx_odsosm_layer', 'label' => 'title', 'tstamp' => 'tstamp', 'crdate' => 'crdate', 'cruser_id' => 'cruser_id', 'sortby' => 'sorting', 'delete' => 'deleted', 'rootLevel' => 1, 'enablecolumns' => array('disabled' => 'hidden'), 'dynamicConfigFile' => t3lib_extMgm::extPath($_EXTKEY) . 'tca.php', 'iconfile' => t3lib_extMgm::extRelPath($_EXTKEY) . 'icon_tx_odsosm_layer.png'));
 /**
  * Tests whether fields are added to a new palette that did not exist before.
  * @test
  * @see t3lib_extMgm::addFieldsToAllPalettesOfField()
  */
 public function canAddFieldsToAllPalettesOfFieldWithoutPaletteExistingBefore()
 {
     $table = uniqid('tx_coretest_table');
     $GLOBALS['TCA'] = $this->generateTCAForTable($table);
     t3lib_extMgm::addFieldsToAllPalettesOfField($table, 'fieldA', 'newA, newA, newB, fieldX');
     $this->assertEquals('fieldX, fieldY', $GLOBALS['TCA'][$table]['palettes']['paletteA']['showitem']);
     $this->assertEquals('fieldX, fieldY', $GLOBALS['TCA'][$table]['palettes']['paletteB']['showitem']);
     $this->assertEquals('fieldX, fieldY', $GLOBALS['TCA'][$table]['palettes']['paletteC']['showitem']);
     $this->assertEquals('fieldX, fieldY', $GLOBALS['TCA'][$table]['palettes']['paletteD']['showitem']);
     $this->assertEquals('newA, newB, fieldX', $GLOBALS['TCA'][$table]['palettes']['generatedFor-fieldA']['showitem']);
 }