class.tx_ter_tcaLabel.php 1.22 KB
Newer Older
1
<?php
2
/*
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
 * This file is part of the TYPO3 CMS project.
 *
 * It is free software; you can redistribute it and/or modify it under
 * the terms of the GNU General Public License, either version 2
 * of the License, or any later version.
 *
 * For the full copyright and license information, please read the
 * LICENSE.txt file that was distributed with this source code.
 *
 * The TYPO3 project - inspiring people to share!
 */

/**
 * TCA label provider
 *
 * @author Kai Vogel <kai.vogel@speedprogs.de>
 */
class tx_ter_tcaLabel
{

    /**
     * Returns an extension key by given params
     *
     * @param array $params Parameters
     * @param object $pObj Parent object reference
     * @return string
     */
    public function getExtensionKey(&$params, &$pObj)
    {
        if (empty($params['row']['uid'])) {
            return;
        }

        $result = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow(
Markus Sommer's avatar
Markus Sommer committed
37 38 39
            'extensionkey',
            'tx_ter_extensions',
            'uid=' . (int)$params['row']['uid']
40 41 42 43 44 45 46 47
        );

        if (!empty($result['extensionkey'])) {
            $params['title'] = htmlspecialchars($result['extensionkey']);
        } else {
            $params['title'] = (int)$params['row']['uid'];
        }
    }
Markus Sommer's avatar
Markus Sommer committed
48
}