TYPO3 API  SVNRelease
CshViewHelper.php
Go to the documentation of this file.
00001 <?php
00002 /*                                                                        *
00003  * This script belongs to the FLOW3 package "Fluid".                      *
00004  *                                                                        *
00005  * It is free software; you can redistribute it and/or modify it under    *
00006  * the terms of the GNU Lesser General Public License as published by the *
00007  * Free Software Foundation, either version 3 of the License, or (at your *
00008  * option) any later version.                                             *
00009  *                                                                        *
00010  * This script is distributed in the hope that it will be useful, but     *
00011  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN-    *
00012  * TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser       *
00013  * General Public License for more details.                               *
00014  *                                                                        *
00015  * You should have received a copy of the GNU Lesser General Public       *
00016  * License along with the script.                                         *
00017  * If not, see http://www.gnu.org/licenses/lgpl.html                      *
00018  *                                                                        *
00019  * The TYPO3 project - inspiring people to share!                         *
00020  *                                                                        */
00021 
00022 /**
00023  * View helper which returns CSH (context sensitive help) button with icon
00024  * Note: The CSH button will only work, if the current BE user has
00025  * the "Context Sensitive Help mode" set to something else than
00026  *  "Display no help information" in the Users settings
00027  * Note: This view helper is experimental!
00028  *
00029  * = Examples =
00030  *
00031  * <code title="Default">
00032  * <f:be.buttons.csh />
00033  * </code>
00034  * <output>
00035  * CSH button as known from the TYPO3 backend.
00036  * </output>
00037  *
00038  * <code title="Full configuration">
00039  * <f:be.buttons.csh table="xMOD_csh_corebe" field="someCshKey" iconOnly="1" styleAttributes="border: 1px solid red" />
00040  * </code>
00041  * <output>
00042  * CSH button as known from the TYPO3 backend with some custom settings.
00043  * </output>
00044  *
00045  * @author Steffen Kamper <info@sk-typo3.de>
00046  * @author Bastian Waidelich <bastian@typo3.org>
00047  * @license http://www.gnu.org/copyleft/gpl.html
00048  */
00049 class Tx_Fluid_ViewHelpers_Be_Buttons_CshViewHelper extends Tx_Fluid_ViewHelpers_Be_AbstractBackendViewHelper {
00050 
00051 
00052     /**
00053      * Render context sensitive help (CSH) for the given table
00054      *
00055      * @param string $table Table name ('_MOD_'+module name). If not set, the current module name will be used
00056      * @param string $field Field name (CSH locallang main key)
00057      * @param boolean $iconOnly If set, the full text will never be shown (only icon)
00058      * @param string $styleAttributes Additional style-attribute content for wrapping table (full text mode only)
00059      * @return string the rendered CSH icon
00060      * @see t3lib_BEfunc::cshItem
00061      */
00062     public function render($table = NULL, $field = '', $iconOnly = FALSE, $styleAttributes = '') {
00063         if ($table === NULL) {
00064             $currentRequest = $this->controllerContext->getRequest();
00065             $moduleName = $currentRequest->getPluginName();
00066             $table = '_MOD_' . $moduleName;
00067         }
00068         $cshButton = t3lib_BEfunc::cshItem($table, $field, $GLOBALS['BACK_PATH'], '', $iconOnly, $styleAttributes);
00069 
00070         return '<div class="docheader-csh">' . $cshButton . '</div>';
00071     }
00072 }
00073 ?>