[TYPO3-core] Patch: Hook in show_item.php

René Fritz rene at typo3.org
Tue Jan 24 13:28:00 CET 2006


This is a CVS patch request

... I just realized that I accidently comitted the patch already. :-/
Therefore the attached file is not a diff but the changed function as 
textfile, sorry.


Type: feature

description:
The patch introduce a hook in show_item.php and make it possible to render own 
info output for records or files which is normally triggered by the (i) icon 
and diplayed in a popup window.

It is implemented in a way that the class itself decide if it wants to output 
the info. Therefore it is possible to register a rendering class for a single 
table or even a single record.

René

-- 
René Fritz
TYPO3 Association - Active Member
http://association.typo3.org/
-------------- next part --------------
	function main()	{
		global $LANG;

		if ($this->access)	{
			$returnLinkTag = t3lib_div::_GP('returnUrl') ? '<a href="'.t3lib_div::_GP('returnUrl').'" class="typo3-goBack">' : '<a href="#" onclick="window.close();">';

//----------new--------------

				// render type by user func
			$typeRendered = false;
			if (is_array ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/show_item.php']['typeRendering'])) {
				foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/show_item.php']['typeRendering'] as $classRef) {
					$typeRenderObj = t3lib_div::getUserObj($classRef);
					if(is_object($typeRenderObj) && method_exists($typeRenderObj, 'isValid') && method_exists($typeRenderObj, 'render'))	{
						if ($typeRenderObj->isValid($this->type, $this)) {
							$this->content .=  $typeRenderObj->render($this->type, $this);
							$typeRendered = true;
							break;
						}
					}
				}
			}
//----------new-end-------------


				// if type was not rendered use default rendering functions
			if(!$typeRendered) {
					// Branch out based on type:
				switch($this->type)	{
					case 'db':
						$this->renderDBInfo();
					break;
					case 'file':
						$this->renderFileInfo($returnLinkTag);
					break;
				}
			}

				// If return Url is set, output link to go back:
			if (t3lib_div::_GP('returnUrl'))	{
				$this->content = $this->doc->section('',$returnLinkTag.'<strong>'.$LANG->sL('LLL:EXT:lang/locallang_core.xml:labels.goBack',1).'</strong></a><br /><br />').$this->content;

				$this->content .= $this->doc->section('','<br />'.$returnLinkTag.'<strong>'.$LANG->sL('LLL:EXT:lang/locallang_core.xml:labels.goBack',1).'</strong></a>');
			}
		}
	}


More information about the TYPO3-team-core mailing list