本文整理匯總了PHP中TYPO3\CMS\Backend\Utility\IconUtility::mapRecordTypeToSpriteIconName方法的典型用法代碼示例。如果您正苦於以下問題:PHP IconUtility::mapRecordTypeToSpriteIconName方法的具體用法?PHP IconUtility::mapRecordTypeToSpriteIconName怎麽用?PHP IconUtility::mapRecordTypeToSpriteIconName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類TYPO3\CMS\Backend\Utility\IconUtility
的用法示例。
在下文中一共展示了IconUtility::mapRecordTypeToSpriteIconName方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getSystemLanguages
/**
* Returns array of system languages
*
* Since TYPO3 4.5 the flagIcon is not returned as a filename in "gfx/flags/*" anymore,
* but as a string <flags-xx>. The calling party should call
* t3lib_iconWorks::getSpriteIcon(<flags-xx>) to get an HTML which will represent
* the flag of this language.
*
* @param integer $page_id Page id (only used to get TSconfig configuration setting flag and label for default language)
* @param string $backPath Backpath for flags
* @return array Array with languages (title, uid, flagIcon)
* @todo Define visibility
*/
public function getSystemLanguages($page_id = 0, $backPath = '')
{
$modSharedTSconfig = \TYPO3\CMS\Backend\Utility\BackendUtility::getModTSconfig($page_id, 'mod.SHARED');
$languageIconTitles = array();
// fallback "old iconstyles"
if (preg_match('/\\.gif$/', $modSharedTSconfig['properties']['defaultLanguageFlag'])) {
$modSharedTSconfig['properties']['defaultLanguageFlag'] = str_replace('.gif', '', $modSharedTSconfig['properties']['defaultLanguageFlag']);
}
$languageIconTitles[0] = array('uid' => 0, 'title' => strlen($modSharedTSconfig['properties']['defaultLanguageLabel']) ? $modSharedTSconfig['properties']['defaultLanguageLabel'] . ' (' . $GLOBALS['LANG']->sl('LLL:EXT:lang/locallang_mod_web_list.xml:defaultLanguage') . ')' : $GLOBALS['LANG']->sl('LLL:EXT:lang/locallang_mod_web_list.xml:defaultLanguage'), 'ISOcode' => 'DEF', 'flagIcon' => strlen($modSharedTSconfig['properties']['defaultLanguageFlag']) ? 'flags-' . $modSharedTSconfig['properties']['defaultLanguageFlag'] : 'empty-empty');
// Set "All" language:
$languageIconTitles[-1] = array('uid' => -1, 'title' => $GLOBALS['LANG']->getLL('multipleLanguages'), 'ISOcode' => 'DEF', 'flagIcon' => 'flags-multiple');
// Find all system languages:
$sys_languages = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('*', 'sys_language', '');
foreach ($sys_languages as $row) {
$languageIconTitles[$row['uid']] = $row;
if ($row['static_lang_isocode'] && \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('static_info_tables')) {
$staticLangRow = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecord('static_languages', $row['static_lang_isocode'], 'lg_iso_2');
if ($staticLangRow['lg_iso_2']) {
$languageIconTitles[$row['uid']]['ISOcode'] = $staticLangRow['lg_iso_2'];
}
}
if (strlen($row['flag'])) {
$languageIconTitles[$row['uid']]['flagIcon'] = \TYPO3\CMS\Backend\Utility\IconUtility::mapRecordTypeToSpriteIconName('sys_language', $row);
}
}
return $languageIconTitles;
}
示例2: getSystemLanguages
/**
* Returns array of system languages
*
* The property flagIcon returns a string <flags-xx>. The calling party should call
* \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon(<flags-xx>) to get an HTML
* which will represent the flag of this language.
*
* @param int $pageId Page id (used to get TSconfig configuration setting flag and label for default language)
* @return array Array with languages (uid, title, ISOcode, flagIcon)
*/
public function getSystemLanguages($pageId = 0)
{
$modSharedTSconfig = BackendUtility::getModTSconfig($pageId, 'mod.SHARED');
// default language and "all languages" are always present
$languages = array(0 => array('uid' => 0, 'title' => $this->getDefaultLanguageLabel($modSharedTSconfig), 'ISOcode' => 'DEF', 'flagIcon' => $this->getDefaultLanguageFlag($modSharedTSconfig)), -1 => array('uid' => -1, 'title' => $this->getLanguageService()->getLL('multipleLanguages'), 'ISOcode' => 'DEF', 'flagIcon' => 'flags-multiple'));
// add the additional languages from database records
$languageRecords = $this->getDatabaseConnection()->exec_SELECTgetRows('*', 'sys_language', '');
foreach ($languageRecords as $languageRecord) {
$languages[$languageRecord['uid']] = $languageRecord;
if ($languageRecord['static_lang_isocode'] && ExtensionManagementUtility::isLoaded('static_info_tables')) {
$staticLangRow = BackendUtility::getRecord('static_languages', $languageRecord['static_lang_isocode'], 'lg_iso_2');
if ($staticLangRow['lg_iso_2']) {
$languages[$languageRecord['uid']]['ISOcode'] = $staticLangRow['lg_iso_2'];
}
}
if ($languageRecord['flag'] !== '') {
$languages[$languageRecord['uid']]['flagIcon'] = IconUtility::mapRecordTypeToSpriteIconName('sys_language', $languageRecord);
}
}
return $languages;
}
示例3: foreignTable
/**
* Adds records from a foreign table (for selector boxes)
*
* @param array $items The array of items (label,value,icon)
* @param array $fieldValue The 'columns' array for the field (from TCA)
* @param array $TSconfig TSconfig for the table/row
* @param string $field The fieldname
* @param boolean $pFFlag If set, then we are fetching the 'neg_' foreign tables.
* @return array The $items array modified.
* @see addSelectOptionsToItemArray(), BackendUtility::exec_foreign_table_where_query()
* @todo Define visibility
*/
public function foreignTable($items, $fieldValue, $TSconfig, $field, $pFFlag = FALSE)
{
// Init:
$pF = $pFFlag ? 'neg_' : '';
$f_table = $fieldValue['config'][$pF . 'foreign_table'];
$uidPre = $pFFlag ? '-' : '';
// Exec query:
$res = BackendUtility::exec_foreign_table_where_query($fieldValue, $field, $TSconfig, $pF);
// Perform error test
$db = $this->getDatabaseConnection();
if ($db->sql_error()) {
$msg = htmlspecialchars($db->sql_error());
$msg .= '<br />' . LF;
$msg .= $this->sL('LLL:EXT:lang/locallang_core.xlf:error.database_schema_mismatch');
$msgTitle = $this->sL('LLL:EXT:lang/locallang_core.xlf:error.database_schema_mismatch_title');
/** @var $flashMessage FlashMessage */
$flashMessage = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', $msg, $msgTitle, FlashMessage::ERROR, TRUE);
/** @var $flashMessageService FlashMessageService */
$flashMessageService = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessageService');
/** @var $defaultFlashMessageQueue FlashMessageQueue */
$defaultFlashMessageQueue = $flashMessageService->getMessageQueueByIdentifier();
$defaultFlashMessageQueue->enqueue($flashMessage);
return array();
}
// Get label prefix.
$lPrefix = $this->sL($fieldValue['config'][$pF . 'foreign_table_prefix']);
// Get icon field + path if any:
$iField = $GLOBALS['TCA'][$f_table]['ctrl']['selicon_field'];
$iPath = trim($GLOBALS['TCA'][$f_table]['ctrl']['selicon_field_path']);
// Traverse the selected rows to add them:
while ($row = $db->sql_fetch_assoc($res)) {
BackendUtility::workspaceOL($f_table, $row);
if (is_array($row)) {
// Prepare the icon if available:
if ($iField && $iPath && $row[$iField]) {
$iParts = GeneralUtility::trimExplode(',', $row[$iField], TRUE);
$icon = '../' . $iPath . '/' . trim($iParts[0]);
} elseif (GeneralUtility::inList('singlebox,checkbox', $fieldValue['config']['renderMode'])) {
$icon = IconUtility::mapRecordTypeToSpriteIconName($f_table, $row);
} else {
$icon = '';
}
// Add the item:
$items[] = array($lPrefix . htmlspecialchars(BackendUtility::getRecordTitle($f_table, $row)), $uidPre . $row['uid'], $icon);
}
}
$db->sql_free_result($res);
return $items;
}