.. You may want to use the usual include line. Uncomment and adjust the path. .. include:: ../Includes.txt =========================== Browser Tutorial Hooks (en) =========================== :Created: 2010-10-13T21:40:33 :Changed: 2011-03-10T22:24:59 :Classification: browser_tut_hooks_en :Description: Handle data from every extension in your extension - supported by hooks of the browser, the TYPO3-Frontend-Engine. :Keywords: forDevelopers, forAdvanced, browser, tutorial, frontend-engine, frontend, engine, hooks :Author: Dirk Wildt - Die Netzmacher :Email: http://wildt.at.die-netzmacher.de :Website: http://die-netzmacher.de :Language: en |img-1| |img-2| Browser Tutorial Hooks (en) .. _Browser-Tutorial-Hooks-en: Browser Tutorial Hooks (en) =========================== Handle data from every extension in your extension - supported by hooks of the browser, the TYPO3-Frontend-Engine. |img-3| Version: 3.6.3, 2011-03-10 Extension Key: browser\_tut\_hooks\_en - Tutorial for the extension Browser (extkey: browser) Language: en Keywords: forDevelopers, forAdvanced, browser, tutorial, frontend- engine, frontend, engine, hooks Copyright 2010-2011, Dirk Wildt - Die Netzmacher, This document is published under the Open Content License available from `http://www.opencontent.org/opl.shtml `_ The content of this document is related to TYPO3 a GNU/GPL CMS/Framework available from www.typo3.org .. _Table-of-Contents: Table of Contents ----------------- `Browser Tutorial Hooks (en) 1 <#__RefHeading__1165_1172745218>`_ `Introduction 3 <#__RefHeading__1513_1172745218>`_ `What does it do? 3 <#__RefHeading__1169_1172745218>`_ `Further Information 3 <#__RefHeading__1171_1172745218>`_ `Use hooks for your extension! 4 <#__RefHeading__1177_1172745218>`_ `rows\_filter\_values 4 <#__RefHeading__4751_964823982>`_ `rows\_filter\_options 4 <#__RefHeading__1956_270592049>`_ `rows\_list\_consolidated 4 <#__RefHeading__4753_964823982>`_ `row\_single\_consolidated 4 <#__RefHeading__2015_991962144>`_ `BR\_TemplateElementsHook 4 <#__RefHeading__1958_270592049>`_ `BR\_TemplateElementsTransformedHook 4 <#__RefHeading__667_270592049>`_ `How to use the hooks? 5 <#__RefHeading__2021_991962144>`_ `ext\_localconf.php 5 <#__RefHeading__2023_991962144>`_ `class.tx\_browsertuthooksen.php 6 <#__RefHeading__2025_991962144>`_ `DRS - Development Reporting System 7 <#__RefHeading__2027_991962144>`_ `Reference 8 <#__RefHeading__55058_1116738509>`_ `Completely browser reference 8 <#__RefHeading__44233_603351207>`_ `Credits 9 <#__RefHeading__1960_270592049>`_ `Martin Bless 9 <#__RefHeading__1962_270592049>`_ `Helpful suggestions 10 <#__RefHeading__1283_2006342602>`_ `Change log 11 <#__RefHeading__3727_2139160512>`_ `Illustration index 12 <#__RefHeading__3729_2139160512>`_ .. _Introduction: Introduction ------------ .. _What-does-it-do: What does it do? ^^^^^^^^^^^^^^^^ |img-4| Illustration 1: Tutorial in PDF format This is a tutorial for the extension Browser (extkey: browser). It is an manual how to use hooks in the browser for your extension .. _Further-Information: Further Information ^^^^^^^^^^^^^^^^^^^ .. _This-tutorial-in-PDF-format: This tutorial in PDF format """"""""""""""""""""""""""" You find this tutorial as a PDF file at - doc/manual.pdf - `http://typo3.org/extensions/repository/view/browser\_tut\_hooks\_en/ `_ `current/info/?tx\_terfe\_pi1%5BdownloadFile%5D=doc%252Fmanual.pdf `_ .. _Browser-Manual-and-Browser-Tutorial-Basics: Browser Manual and Browser Tutorial Basics """""""""""""""""""""""""""""""""""""""""" Manual: The Browser has it's own manual (with the reference of course). - HTML `http://typo3.org/documentation/document-library/extension- manuals/browser/current/ `_ - PDF: `http://typo3.org/extensions/repository/view/browser/current/info /?tx\_terfe\_pi1%5BdownloadFile%5D=doc%252Fmanual.pdf `_ Tutorial Basics: A lot of step-by-step introductions. - HTML: `http://typo3.org/documentation/document-library/extension- manuals/browser\_tut\_basics\_en/current/ `_ - `PDF: `_ `http://typo3 .org/extensions/repository/view/browser\_tut\_basics\_en/current/info/ ?tx\_terfe\_pi1%5BdownloadFile%5D=doc%252Fmanual.pdf `_ .. _Forum: Forum """"" |img-5| Illustration 2: The TYPO3-Frontend-Engine Browser Forum The Browser has its own forum (leading language is German). You are welcome to post any question, bug or snippet code at TYPO3-Frontend-Engine Browser: Forum `http://typo3-browser-forum.de/ `_ .. _Use-hooks-for-your-extension: Use hooks for your extension! ----------------------------- The Browser enables to publish data in list views and single views. You can access the data of any extension using the browser's hooks. There are several hooks available. .. _rows-filter-values: rows\_filter\_values ^^^^^^^^^^^^^^^^^^^^ This hook provides the data from any extension as rows for the filters. The rows are consolidated. Consolidation means: - you will receive the data like shown in the browser filters (list view only) but without any HTML code and without any TypoScript wrapping - the data are localized, if the extension is localized - non unique data is removed .. _rows-filter-options: rows\_filter\_options ^^^^^^^^^^^^^^^^^^^^^ A hook for manipulation the values for checkboxes, radiobuttons and selectboxes. .. _rows-list-consolidated: rows\_list\_consolidated ^^^^^^^^^^^^^^^^^^^^^^^^ This hook provides the data from any extension as rows. The rows are consolidated. Consolidation means: - you will receive the data like shown in the browser list view but without any HTML code and without any TypoScript wrapping - the data are localized, if the extension is localized - the data are grouped, if the group property of the browser is enabled - non unique data is removed .. _row-single-consolidated: row\_single\_consolidated ^^^^^^^^^^^^^^^^^^^^^^^^^ This hook is similar to the hook rows\_list\_consolidated except that it is triggered by the single view. It may provide data of any extension as elements of the single-view-row. The elements are consolidated. Consolidation means: - you will receive the data like shown in the browser's single view but without any HTML code and without any TypoScript wrapping - the data is localized if the extension is localized - non unique data is removed .. _BR-TemplateElementsHook: BR\_TemplateElementsHook ^^^^^^^^^^^^^^^^^^^^^^^^ This is a hook to modify elements that are going to be displayed in the next line of a list view or in the next single view. This gives access to the elements of a row *before* Typoscript processing is done. The row is maintained as *$this->\_elements* and provided in the example function as *$obj->\_elements* . To modify the browser's output modify this array *in place* . .. _BR-TemplateElementsTransformedHook: BR\_TemplateElementsTransformedHook ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ This is a hook to modify elements that are going to be displayed in the next line of a list view or in the next single view. This gives access to the elements of a row *after* Typoscript processing has been done. Thus according to the Typoscript the elements may have been modified and links may have been added. The row is maintained as *$this->\_elementsTransformed* and provided in the example function as *$obj->\_elementsTransformed* . Attention: There is a second array *$obj->\_elementsBoolSubstitute* that holds additional information. You don't need to care about this one if you only modify the values of the elements. But if you add or delete elements you have to treat the array *$obj->\_elementsBoolSubstitute* alike. In other words: the two array alway have to be of same size and they have to use the same keys. To influence the browsers output modify the arrays *in place* . .. _How-to-use-the-hooks: How to use the hooks? --------------------- This extension provides sample code. You can use this code for your own extension. You have to adapt the code to your needs. You need an own extension like this extension. This is the file tree of browser\_tut\_hooks\_en: \|-- ChangeLog \|-- class.tx\_browsertuthooksen.php \|-- doc \| \|-- manual.pdf \| \`-- manual.sxw \|-- ext\_emconf.php \|-- ext\_icon.gif \`-- ext\_localconf.php 1 directory, 7 files You have to configure two files: - class.tx\_browsertuthooksen.php - ext\_localconf.php .. _ext-localconf-php: ext\_localconf.php ^^^^^^^^^^^^^^^^^^ vardump\_rows\_filter\_values'; $GLOBALS['TYPO3\_CONF\_VARS']['EXTCONF']['browser']['rows\_filter\_opt ions'][] = 'EXT:browser\_tut\_hooks\_en/class.tx\_browsertuthooksen.php:' . 'tx\_browsertuthooksen->vardump\_rows\_filter\_options'; $GLOBALS['TYPO3\_CONF\_VARS']['EXTCONF']['browser']['rows\_list\_conso lidated'][] = 'EXT:browser\_tut\_hooks\_en/class.tx\_browsertuthooksen.php:' . 'tx\_browsertuthooksen->vardump\_rows'; $GLOBALS['TYPO3\_CONF\_VARS']['EXTCONF']['browser']['row\_single\_cons olidated'][] = 'EXT:browser\_tut\_hooks\_en/class.tx\_browsertuthooksen.php:' . 'tx\_browsertuthooksen->vardump\_elements'; $GLOBALS['TYPO3\_CONF\_VARS']['EXTCONF']['browser']['BR\_TemplateEleme ntsHook'][] = 'EXT:browser\_tut\_hooks\_en/class.tx\_browsertuthooksen.php:' . 'tx\_browsertuthooksen'; $GLOBALS['TYPO3\_CONF\_VARS']['EXTCONF']['browser']['BR\_TemplateEleme ntsTransformedHook'][] = 'EXT:browser\_tut\_hooks\_en/class.tx\_browsertuthooksen.php:'. 'tx\_browsertuthooksen'; } ?> .. _Comment: Comment """"""" In the example above we like to use all six hooks. We have to register it in the ext\_localconf.php. The PHP class file is called class.tx\_browsertuthooksen.php (see the file in the next section below). The name of your class depends on the name of your extension. .. _class-tx-browsertuthooksen-php: class.tx\_browsertuthooksen.php ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ The file class.tx\_browsertuthooksen.php can be a default php snippet for your own php class. \_elements in place if (0) { debug($obj->\_elements, '$obj->\_elements', \_\_LINE\_\_, \_\_FILE\_\_); } } ... function vardump\_elements(&$params, &$pObj) { // you may manipulate the whole $pObj in place if (0) { var\_dump(\_\_METHOD\_\_ . ' (line '. \_\_LINE\_\_ . ')', $pObj->pObj->elements); } } ... } if (defined('TYPO3\_MODE') && $TYPO3\_CONF\_VARS[TYPO3\_MODE]['XCLASS' ]['ext/browser\_tut\_hooks\_en/class.tx\_browsertuthooksen.php']) { include\_once($TYPO3\_CONF\_VARS[TYPO3\_MODE]['XCLASS']['ext/browser\_ tut\_hooks\_en/class.tx\_browsertuthooksen.php']); } ?> .. _Comment: Comment """"""" Line 23: We receive some data with our own method vardump\_elements.&$params is a reference to the whole browser object. The parameter enables you, to manipulate anyBowser data.$pObj is the Browser object. Because the hook is placed in a class, which is a child of the Browser main class,you have to use the variable $pObj twice: $pObj->$pObj->...If you want to know more about the possibilites of the hook, please read the section"DRS - Development Reporting System" on page 7 below. Line 26: If you are set 0 to 1, this extension will var\_dump the current elements. .. _DRS-Development-Reporting-System: DRS - Development Reporting System ---------------------------------- The DRS - the Development Reporting System - has the new property "Hooks" from version 3.6.0. If you have enabled the DRS "Hooks" in the Browser, you will get an report: - if any extension doesn't use the hooks or in the other case - the name of all extensions, which are using the hook(s). .. _Reference: Reference --------- .. _Completely-browser-reference: Completely browser reference ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - HTML `http://typo3.org/documentation/document-library/extension- manuals/browser/current/ `_ - PDF: `http://typo3.org/extensions/repository/view/browser/current/info /?tx\_terfe\_pi1%5BdownloadFile%5D=doc%252Fmanual.pdf `_ .. _Credits: Credits ------- .. _Martin-Bless: Martin Bless ^^^^^^^^^^^^ Thanks to Martin Bless ( `http://forge.typo3.org/users/1386 `_ ) for the hooks - BR\_TemplateElementsHook - BR\_TemplateElementsTransformedHook .. _Helpful-suggestions: Helpful suggestions ------------------- If you have helpful suggestions, feel free to publish any question, bug or code snippet on `http://typo3-browser-forum.de/ `_ Posts are welcome in English and German. .. _Change-log: Change log ---------- 3.6.3 **New Features** \* Added hooks\* BR\_TemplateElementsHook($obj) - thanks to Martin Bless\* BR\_TemplateElementsTransformedHook($obj) - thanks to Martin Bless\* rows\_filter\_options **Maintenance** \* Hook rows\_filter\_consolidated is moved to rows\_filter\_values 3.6.2 **New Feature** \* 12813: New hook rows\_filter\_consolidatedafter consolidated rows and before filter 3.6.0 **Initial release** .. _Illustration-index: Illustration index ------------------ Illustration 1: Tutorial in PDF format 3 Illustration 2: The TYPO3-Frontend-Engine Browser Forum 3 12 .. ######CUTTER_MARK_IMAGES###### .. |img-1| image:: img-1.png .. :align: left .. |img-2| image:: img-2.png .. :border: 0 .. :height: 21 .. :hspace: 9 .. :id: Grafik2 .. :name: Grafik2 .. :width: 87 .. |img-3| image:: img-3.png .. :align: bottom .. :border: 0 .. :height: 268 .. :id: graphics5 .. :name: graphics5 .. :width: 302 .. |img-4| image:: img-4.jpeg .. :align: left .. :border: 0 .. :height: 258 .. :id: graphics1 .. :name: graphics1 .. :width: 227 .. |img-5| image:: img-5.jpeg .. :align: left .. :border: 0 .. :height: 161 .. :id: graphics81 .. :name: graphics81 .. :width: 302