├── ChangeLog ├── Classes ├── Controller │ ├── CollectionController.php │ └── DefaultController.php ├── ExtDirect │ └── Server.php ├── Service │ ├── ContextMenuOptions.php │ └── RteTransformation.php ├── Userfuncs │ └── Tca.php ├── Utilities │ └── Viewport.php ├── ViewHelpers │ └── Be │ │ ├── EditLinkViewHelper.php │ │ ├── HeaderViewHelper.php │ │ └── IconViewHelper.php └── Xclass │ └── NewRecordController.php ├── Configuration ├── Flexforms │ ├── flexform_ds1.xml │ ├── flexform_ds2.xml │ ├── flexform_ds3.xml │ └── flexform_ds4.xml ├── TCA │ ├── Overrides │ │ ├── fe_users.php │ │ ├── pages.php │ │ └── tt_content.php │ ├── tx_examples_dummy.php │ └── tx_examples_haiku.php └── TypoScript │ └── setup.txt ├── Documentation ├── .gitignore ├── Images │ └── FlashMessages.png ├── Includes.txt ├── Index.rst ├── Introduction │ └── Index.rst ├── Maintainers │ ├── ErrorHandlingDemo │ │ └── Index.rst │ ├── FlashMessagesDemo │ │ └── Index.rst │ └── Index.rst └── Users │ └── Index.rst ├── LICENSE.txt ├── README.txt ├── Resources ├── Private │ ├── Language │ │ ├── custom.xlf │ │ ├── de.custom.xlf │ │ ├── locallang.xlf │ │ ├── locallang_csh_txexampleshaiku.xlf │ │ └── locallang_db.xlf │ ├── Layouts │ │ ├── Default.html │ │ └── Module.html │ ├── Partials │ │ └── Module │ │ │ └── Header.html │ └── Templates │ │ ├── Collection │ │ └── Index.html │ │ └── Default │ │ ├── Clipboard.html │ │ ├── Flash.html │ │ ├── Links.html │ │ ├── Log.html │ │ └── Tree.html └── Public │ ├── Images │ ├── Archive.png │ ├── Dummy.png │ ├── Haiku.png │ ├── JapaneseGarden.jpg │ ├── PageTree.png │ ├── PiErrorWizard.png │ └── moduleIcon.png │ └── JavaScript │ └── Application.js ├── components └── navigation │ └── javascript │ └── Navigation.js ├── ext_emconf.php ├── ext_icon.gif ├── ext_localconf.php ├── ext_tables.php ├── ext_tables.sql ├── pierror ├── class.tx_examples_pierror.php └── class.tx_examples_pierror_wizicon.php └── pihtml └── class.tx_examples_pihtml.php /ChangeLog: -------------------------------------------------------------------------------- 1 | commit bb94b40a7727a6742087724c75a010cf6bb39519 2 | Author: Francois Suter 3 | 4 | [TASK] Release version 0.6.2 5 | 6 | commit 3a466466d1ae53dd7b9c4592624a73345b03024d 7 | Author: Wouter Wolters 8 | 9 | [TASK] Cleanup code base 10 | 11 | commit e954e2510cf88978af97024d2872d959d981bf79 12 | Author: Francois Suter 13 | 14 | [TASK] Release version 0.6.1 15 | 16 | commit 3ca4e1e346733bd8e909a5dd67529b20e8ac4f8d 17 | Author: Francois Suter 18 | 19 | [FEATURE] Use TCA/Overrides for TCA changes 20 | 21 | commit 35be91418e7c4bd12d05d8b3e105aeacc9e29b79 22 | Author: Francois Suter 23 | 24 | [BUGFIX] Wrong code in content wizard 25 | 26 | commit 034ebb7a383b4059f34881c2becf20f2f03213b6 27 | Author: Francois Suter 28 | 29 | [TASK] Release version 0.6.0 30 | 31 | commit 751c7a49c80a8789e0eb370ff6931e8e466b5aaa 32 | Author: Francois Suter 33 | 34 | [TASK] Cleanup file structure 35 | 36 | commit d68b14e84096bec60fc9131246365453da7b4629 37 | Author: Francois Suter 38 | 39 | [TASK] Move flexform definitions 40 | 41 | commit 5907002f8b218127b3abc99f4a84cb2028bd8886 42 | Author: Francois Suter 43 | 44 | [TASK] Migrate and update documentation 45 | 46 | commit e7a281debaddd8c170d4f03efde7cd4637100968 47 | Author: Francois Suter 48 | 49 | [TASK] Use sprite for tables 50 | 51 | commit 9fcb7493cc52e8a5a6eea68f0778d4ba706c245d 52 | Author: Francois Suter 53 | 54 | [TASK] Adapt BE module layout 55 | 56 | commit b5a1925a4e35d21775248ab51be3a1913e561044 57 | Author: Wouter Wolters 58 | 59 | [FEATURE] Add example of adding extra fields to User Settings 60 | 61 | commit 20f80bfa079b72635086b877b2ab52e089dbc173 62 | Author: Francois Suter 63 | 64 | [TASK] Demonstrate exclude flag in makeCategorizable 65 | 66 | commit f250fad9a5cc047f74635e7fa7d05137dccefa45 67 | Author: Francois Suter 68 | 69 | [BUGFIX] Wrong namespaces in Log configuration 70 | 71 | commit 9646bc88b0135e0bf5e75d78b4060e07d68268b6 72 | Author: Francois Suter 73 | 74 | [FEATURE] Add FAL examples 75 | 76 | commit e134fd7f3814303aa40f1a323732122a9419075d 77 | Author: Helmut Hummel 78 | 79 | [BUGFIX] Fix weirdness field wizard 80 | 81 | commit 1e9bdf5f02e305c44f6e603a04fd4cbfbcb03a64 82 | Author: Wouter Wolters 83 | 84 | [TASK] Create a backend module URL with BackendUtility::getModuleUrl 85 | 86 | commit 76ebc7cbee6d677e9b96c42be4438c2aca024eec 87 | Author: Wouter Wolters 88 | 89 | [TASK] Adjust colorpicker wizard registration 90 | 91 | commit 22b6c9ecf53f03b871607809255893743ce7b84e 92 | Author: Francois Suter 93 | 94 | [FEATURE] Filter for select items 95 | 96 | commit 160e080988e38efb193d351caf19b43bd7fec40c 97 | Author: Steffen Müller 98 | 99 | [FEATURE] Update FlashMessage API calls in DefaultController 100 | 101 | commit af1351ea55b08312841ce94267294c58772fe38e 102 | Author: Francois Suter 103 | 104 | [TASK] CGL cleanup 105 | 106 | commit bcd55da4e166d92223a6fa52aa4c9198aca210f5 107 | Author: Francois Suter 108 | 109 | [TASK] Removed loadTCA calls 110 | 111 | commit 3e8713e66d4fb5a44f2c0f0f5b5a9fedd7d7e1f4 112 | Author: Francois Suter 113 | 114 | [FEATURE] Example for suggest wizard 115 | 116 | commit 0eafb5d8230d3a2ce915d62c2396016de3bd12f8 117 | Author: Francois Suter 118 | 119 | [FEATURE] Code for TCA interface 120 | 121 | commit e886f9fa6615805d17610cc724be7daa54cc4393 122 | Author: Francois Suter 123 | 124 | [FEATURE] Move TCA configuration 125 | 126 | commit 4277d81e7648a3d52e88f224e59e8c11b88c1af0 127 | Author: Francois Suter 128 | 129 | [TASK] Finish moving locallang files 130 | 131 | commit 8ba8878e8744ddd933679327a1ff32e8cc303769 132 | Author: Francois Suter 133 | 134 | [FEATURE] Add categories examples 135 | 136 | commit 719e88eb1618dd9a0db09712f38f4c46b8769c30 137 | Author: francois 138 | 139 | Added example for creating new page types, resolves #48816 140 | 141 | commit a98bdb3fa90d9c6ec4cadd1bdc58803454da3803 142 | Author: francois 143 | 144 | Released to TER as version 0.5.0 145 | 146 | commit 30cad827cff6e6a1a83f82b536a492e14a9cfcd0 147 | Author: francois 148 | 149 | Changed table icons and added attribution, resolves #48130 150 | 151 | commit 2bc76534b846624bc60403ab29b6ba1e60001b8a 152 | Author: francois 153 | 154 | Added code samples using system collections, resolves #48104 155 | 156 | commit 6dc4b7364cade8c2723d42d636025a5057152717 157 | Author: francois 158 | 159 | Added example RTE transformation, resolves #47884 160 | 161 | commit 46dc01b13193b1a925e0e1ba419a0451ecf67a77 162 | Author: francois 163 | 164 | Improved custom options example, resolves #47591 165 | 166 | commit d6ba2ffe55a2e897a97c167450785300a59f3584 167 | Author: francois 168 | 169 | Added plugin registration example, resolves #47557 170 | 171 | commit 57c1a90e0e61ce8473b55847edcda38f4dea868f 172 | Author: francois 173 | 174 | Removed code for extra tables in Page module, resolves #47553 175 | 176 | commit 5a7fe5ace164c1aaa1651bd57781b8a1c39e6922 177 | Author: francois 178 | 179 | Added example code for edit links, resolves #47536 180 | 181 | commit 14569d728b257a55d5e5228d87bfa8d84802efe7 182 | Author: francois 183 | 184 | Removed unneeded phpDoc 185 | 186 | commit 1258c66a3f6eeb4a569e62d009087fcb4d9f7d95 187 | Author: francois 188 | 189 | Added example code for parsing HTML, resolves #47434 190 | 191 | commit bc12745551ba82ced649fed5bd3961d72eb8851c 192 | Author: francois 193 | 194 | Added example code for non-page tree CSM, resolves #47405 195 | 196 | commit a2dc76c90cd11479db82808c35a6c3985e7a0dfd 197 | Author: francois 198 | 199 | Added SVN Id keyword 200 | 201 | commit a0387ee4b203685f83e02b55ec0c2c5c6132e032 202 | Author: francois 203 | 204 | Added example code for clipboard access, resolves #47374 205 | 206 | commit a16c4c8188624b2b977989104e87580fe4aa10f0 207 | Author: francois 208 | 209 | Added example for creating page tree, resolves #47310 210 | 211 | commit 4e15f121590f3dfce1b8fdee9ab3d556f43bfd8b 212 | Author: francois 213 | 214 | Changed namespace to use "Documentation" instead of "TYPO3" (reserved), references #45946 215 | 216 | commit 6e1ec6f513c759b7ff522cd306af76d918e235ed 217 | Author: francois 218 | 219 | Follow up to #46531, changed "xml" extension to "xlf" 220 | 221 | commit 1f060afe3fc8fe0cb3bc0791a0febb19f4c5a15a 222 | Author: francois 223 | 224 | Added example usage of locallangXMLOverride, resolves #46531 225 | 226 | commit b3ef20b8c3e95e7ad77fbdc90c3fe08a8394ac80 227 | Author: francois 228 | 229 | Corrected escaping 230 | 231 | commit 6b6bb9ee8b8ec6721c77107fa8a156578f0cc47e 232 | Author: francois 233 | 234 | Moved language files to XLIFF, resolves #46150 235 | 236 | commit a03039049ff8fe4fd897d7b67fb37e98d7945c66 237 | Author: francois 238 | 239 | Added Logging API examples, resolves #46149 240 | 241 | commit bffab3f76eafc1fbc03efda7b7e5dad4368bbc43 242 | Author: francois 243 | 244 | Changed code to match TYPO3 6.0-style, second iteration, references #45946 245 | 246 | commit bde35736f2aee5d9243c8603ecff3f6e2ea9dcf3 247 | Author: francois 248 | 249 | Changed code to match TYPO3 6.0-style, first iteration, references #45946 250 | 251 | commit 34c1a9d666e2ee5efe4b10b36aef2bdc4ad57ee5 252 | Author: francois 253 | 254 | Changed BE module icon too, references #45939 255 | 256 | commit fb0b2cbe72329cf3bd9d0e0c8f530b5f57bb9229 257 | Author: francois 258 | 259 | Added error handlign demonstration FE plugin, resolves #45940 260 | 261 | commit ae0573cdf868cf371204f298c85b8c9377766df2 262 | Author: francois 263 | 264 | Adapted extension icon to orange-only logo, resolves #45939 265 | 266 | commit a4526bacfc07f32e2b925ce97f171f6c37f3f5db 267 | Author: francois 268 | 269 | Released to TER as version 0.4.0 270 | 271 | commit 87ad2a72878ab74180f189b9ed301328f77be66a 272 | Author: francois 273 | 274 | Added examples related to the TYPO3 Viewport, resolves #42854 275 | 276 | commit c3cf5962e32e922a35382f201f8ee23c70bf29f6 277 | Author: francois 278 | 279 | Added ExtDirect call example, resolves #42799 280 | 281 | commit f36b9223d2b743bed5926a1fba7b16750571b1b0 282 | Author: francois 283 | 284 | Added BE module for code examples, started with flash messages, resolves #42625 285 | Raised compatibility to TYPO3 4.7 286 | 287 | commit 594964904bea5b32a2492e1afe2ad3e1e3baf34a 288 | Author: francois 289 | 290 | Removed TCEforms XCLASS example, resolves #42624 291 | 292 | commit 27a250817d0736c3d8f63b2ec921a18e612c5012 293 | Author: francois 294 | 295 | CGL cleanup 296 | 297 | commit ad7b574cbf1047e27a242256b722118a53dd4cdd 298 | Author: francois 299 | 300 | Released to TER as version 0.3.0 301 | 302 | commit a51fa8e87e56fba1b52fef3b4a09cc94f53f9870 303 | Author: francois 304 | 305 | Added another example of TCA customization from start to finish, including TS tuning 306 | 307 | commit 4e4a86fcfcb084b3317e6a60b7a881c6815033da 308 | Author: francois 309 | 310 | Improved naming of variables 311 | 312 | commit 2f45b631189f6c291811622d76ab60a1086be2be 313 | Author: francois 314 | 315 | Added configuration for new backend search properties 316 | 317 | commit 21472c5c1d378b7d90b0c38a38802f32fb3e32e4 318 | Author: francois 319 | 320 | Added soft-reference parser to the RTE field of haiku records 321 | 322 | commit 4a8a1392983a25ab2ded67b1e171db706b56b5d2 323 | Author: francois 324 | 325 | Added field for demonstrating slider wizard 326 | 327 | commit a2d093a0314e6608178c53e62997791ead95d09a 328 | Author: francois 329 | 330 | Expanded user-type field example to include new parameters property 331 | 332 | commit 532b0d7bc42ed3ab2121977d1415e6e5fc04e535 333 | Author: francois 334 | 335 | Expanded disable_controls property example to cover new options with TYPO3 4.6 336 | 337 | commit f4e5b0fc24003e37b76f21d674c1a893da739ca8 338 | Author: francois 339 | 340 | Released to TER as version 0.2.0, resolves #31425 341 | 342 | commit 1b4c1fb7f11fa9049be9fcc64138020f19dd6b13 343 | Author: francois 344 | 345 | Raised version compatibility for TYPO3 4.5, resolves #30694 346 | 347 | commit 06f12a54d52f8e3e153cb22f1d6ce9e956b5aa3f 348 | Author: francois 349 | 350 | Updated the documentation 351 | 352 | commit 84fce4c13eff52a1960af707cdcd9c2b34c8154e 353 | Author: francois 354 | 355 | Added example for usage of TSconfig markers in select-type fields 356 | 357 | commit 7813cd921e56b6e7fb9e3bded8f68237f58f374d 358 | Author: francois 359 | 360 | Added example for tree render mode of select-type fields 361 | 362 | commit 5239cd9fc52fa06d845b6545a71e33d076b9a1a9 363 | Author: francois 364 | 365 | Added some helpful comments 366 | 367 | commit 697d2d098c783f43b855e135f33341c0d1a85e2a 368 | Author: francois 369 | 370 | Removed unused types options from dummy table 371 | 372 | commit d0eff83d5956998f9d5ade3281fe36bc9949ff5d 373 | Author: francois 374 | 375 | Added example fields for showing disable_controls property (group-type fields) 376 | 377 | commit ff0d0741bddcb82f8ebc43b89fdbdc0ee1c13cd0 378 | Author: francois 379 | 380 | Updated ChangeLog file 381 | 382 | commit d8f08aff7fd47843ac0294ab21d2af7a42b30cfd 383 | Author: francois 384 | 385 | Excluded TCA linebreaks from tceforms hook (otherwise they don't work anymore) 386 | 387 | commit 5ac55ac11b3aa665aef860cb4173a3884886f169 388 | Author: francois 389 | 390 | CGL cleanup 391 | 392 | commit 5c05322e1cc02a680bb76b7c46bab227a3b3483b 393 | Author: francois 394 | 395 | Added example of label_userFunc method 396 | 397 | commit 47f60f9e5b62ea08440460268ecaf28d3e1c6746 398 | Author: francois 399 | 400 | Released to TER as version 0.1.0 401 | 402 | commit 893df759e541ac58fd13077a26583b4e08a963a1 403 | Author: francois 404 | 405 | Small improvements to manual 406 | 407 | commit 829b9aba34c4ffd85f5467f5a044af3f1e4cd095 408 | Author: francois 409 | 410 | Small improvements to manual 411 | 412 | commit 05e12965041b1499e3fb9c2d99541dac78b6e311 413 | Author: francois 414 | 415 | Added usage comments 416 | 417 | commit 692107c9cd9516862b319ffc14728715f0d9ada1 418 | Author: francois 419 | 420 | Added manual 421 | 422 | commit 1a385b7a8e06798c991a4458af79c8e4e6357f24 423 | Author: francois 424 | 425 | Added SVN Id keyword 426 | 427 | commit a162ab44cfe0b4bb3cd0628f0ab89dee52caf780 428 | Author: francois 429 | 430 | Changed references to renamed TCA manipulation class 431 | Moved flexforms to own subfolder 432 | 433 | commit eeed7c28c6452d6cd6fdf400a09fec3d9e5017a5 434 | Author: francois 435 | 436 | Renamed TCA manipulation class 437 | 438 | commit a9fbb975f7a0cd222de6268f8dba7d60311026cc 439 | Author: francois 440 | 441 | Added code for listing tt_news records in Web > Page module 442 | Added custom permission options 443 | 444 | commit a4cd568a0619ec997560a1ecd4986f93c3c0fb1b 445 | Author: francois 446 | 447 | Added second XCLASSing example 448 | Moved XCLASS classes to "xclasses" subfolder 449 | 450 | commit 9285d380521a64bee1b9982486e51183e7bf60a8 451 | Author: francois 452 | 453 | Added XCLASSing example 454 | 455 | commit 288eed6458a4fcbf45a1d9f096f4f08eb9f4ff36 456 | Author: francois 457 | 458 | Adjusted TCA to use TBE_STYLES for haiku table 459 | 460 | commit 2db24d1c78cd87a2a120f7d46b9843f4b9d5a067 461 | Author: francois 462 | 463 | Added SVN Id keyword 464 | 465 | commit cfa34568fdcbef73a4868a6a773d3f05f907ca68 466 | Author: francois 467 | 468 | Added colorpicker wizard example 469 | 470 | commit 5378a682340dadc6ec93cd6eb2974e50324aec8c 471 | Author: francois 472 | 473 | Added wizard example 474 | 475 | commit 4407f9a65a606688223cb86942b8764708297c2a 476 | Author: francois 477 | 478 | Added more examples for TCA special configurations 479 | 480 | commit 37dd4c5bbd0b8803499d358bac52686d5beb1f98 481 | Author: francois 482 | 483 | Added examples for TCA special configurations 484 | 485 | commit 1d2630d02098cc44f1df31229f717943c8415f2f 486 | Author: francois 487 | 488 | Added code examples for TCA types and palettes 489 | 490 | commit c7e244d8c2ea75d9f5e6ffdae1ba2af5f92dd6d3 491 | Author: francois 492 | 493 | Added a sample table to show some TCA manipulations 494 | 495 | commit e0cbd3d1505bc367f1b896a765bbb6b1b3543663 496 | Author: francois 497 | 498 | Added code examples for flex-type fields 499 | 500 | commit 23b5f572137d4a0ad46bae59df69318b5b447cf1 501 | Author: francois 502 | 503 | Added configuration for two sample plugins (no FE code) 504 | 505 | commit fb0372b748b151868506ca7fdcfed9f1a961baa9 506 | Author: francois 507 | 508 | Added code example for select-type field definition 509 | Added code example for user-defined field 510 | 511 | commit a1b68354c7e24a1413d555432b7cdd1a3808eba1 512 | Author: francois 513 | 514 | Initial code from Kickstarter 515 | 516 | commit ca3417b99e13449803d9fc7d488c1e837482938d 517 | Author: www 518 | 519 | Initializing project examples (4/4) 520 | -------------------------------------------------------------------------------- /Classes/Controller/CollectionController.php: -------------------------------------------------------------------------------- 1 | 21 | * @package TYPO3 22 | * @subpackage tx_examples 23 | */ 24 | class CollectionController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionController { 25 | 26 | /** 27 | * @var \TYPO3\CMS\Core\Collection\RecordCollectionRepository 28 | * @inject 29 | */ 30 | protected $collectionRepository; 31 | 32 | /** 33 | * Renders the list of all existing collections and their content 34 | * 35 | * @return void 36 | */ 37 | public function indexAction() { 38 | // Get all existing collections 39 | /** @var \TYPO3\CMS\Core\Collection\AbstractRecordCollection $collections */ 40 | $collections = $this->collectionRepository->findAll(); 41 | 42 | // Load the records in each collection 43 | /** @var \TYPO3\CMS\Core\Collection\StaticRecordCollection $aCollection */ 44 | foreach ($collections as $aCollection) { 45 | $aCollection->loadContents(); 46 | } 47 | 48 | // Assign the "loaded" collections to the view 49 | $this->view->assign('collections', $collections); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /Classes/Controller/DefaultController.php: -------------------------------------------------------------------------------- 1 | 21 | * @package TYPO3 22 | * @subpackage tx_examples 23 | */ 24 | class DefaultController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionController { 25 | 26 | /** 27 | * Renders the list of all possible flash messages 28 | * 29 | * @return void 30 | */ 31 | public function flashAction() { 32 | // Issue one of each type of flash messages 33 | $this->addFlashMessage( 34 | 'This is a notice message', 35 | 'Notification', 36 | \TYPO3\CMS\Core\Messaging\FlashMessage::NOTICE 37 | ); 38 | $this->addFlashMessage( 39 | 'This is an information message', 40 | 'Information', 41 | \TYPO3\CMS\Core\Messaging\FlashMessage::INFO 42 | ); 43 | $this->addFlashMessage( 44 | 'This is a success message', 45 | 'Hooray!', 46 | \TYPO3\CMS\Core\Messaging\FlashMessage::OK 47 | ); 48 | $this->addFlashMessage( 49 | 'This is a warning message', 50 | 'Watch out', 51 | \TYPO3\CMS\Core\Messaging\FlashMessage::WARNING 52 | ); 53 | $this->addFlashMessage( 54 | ' 55 |

This is an error message

56 |
    57 |
  • It\'s inside a div
  • 58 |
  • so it can contain
  • 59 |
  • pretty much any markup
  • 60 |
61 | ', 62 | 'Whoops!', 63 | \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR 64 | ); 65 | $this->addFlashMessage( 66 | 'This message is forced to be NOT stored in the session by setting the forth argument to FALSE.', 67 | 'Success', 68 | \TYPO3\CMS\Core\Messaging\FlashMessage::OK, 69 | FALSE 70 | ); 71 | $this->addFlashMessage('This is a simple message, by default without title and with severity OK.'); 72 | } 73 | 74 | /** 75 | * Creates some entries using the 6.0+ logging API 76 | * 77 | * @return void 78 | */ 79 | public function logAction() { 80 | /** @var $logger \TYPO3\CMS\Core\Log\Logger */ 81 | $logger = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\CMS\Core\Log\LogManager')->getLogger(__CLASS__); 82 | $logger->info('Everything went fine.'); 83 | $logger->warning('Something went awry, check your configuration!'); 84 | $logger->error( 85 | 'This was not a good idea', 86 | array( 87 | 'foo' => 'bar', 88 | 'bar' => $this, 89 | ) 90 | ); 91 | $logger->log( 92 | \TYPO3\CMS\Core\Log\LogLevel::CRITICAL, 93 | 'This is an utter failure!' 94 | ); 95 | $this->addFlashMessage( 96 | '3 log entries created', 97 | '', 98 | \TYPO3\CMS\Core\Messaging\FlashMessage::INFO 99 | ); 100 | } 101 | 102 | /** 103 | * Displays a page tree 104 | * 105 | * @return void 106 | */ 107 | public function treeAction() { 108 | // Get page record for tree starting point. May be passed as an argument. 109 | try { 110 | $startingPoint = $this->request->getArgument('page'); 111 | } 112 | catch (\Exception $e) { 113 | $startingPoint = 1; 114 | } 115 | $pageRecord = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecord( 116 | 'pages', 117 | $startingPoint 118 | ); 119 | 120 | // Create and initialize the tree object 121 | /** @var $tree \TYPO3\CMS\Backend\Tree\View\PageTreeView */ 122 | $tree = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Tree\\View\\PageTreeView'); 123 | $tree->init('AND ' . $GLOBALS['BE_USER']->getPagePermsClause(1)); 124 | 125 | // Creating the icon for the current page and add it to the tree 126 | $html = \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIconForRecord( 127 | 'pages', 128 | $pageRecord, 129 | array( 130 | 'title' => $pageRecord['title'] 131 | ) 132 | ); 133 | $tree->tree[] = array( 134 | 'row' => $pageRecord, 135 | 'HTML' => $html 136 | ); 137 | 138 | // Create the page tree, from the starting point, 2 levels deep 139 | $depth = 2; 140 | $tree->getTree( 141 | $startingPoint, 142 | $depth, 143 | '' 144 | ); 145 | \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('page tree', 'examples', 0, $tree->tree); 146 | 147 | // Pass the tree to the view 148 | $this->view->assign( 149 | 'tree', 150 | $tree->tree 151 | ); 152 | } 153 | 154 | /** 155 | * Displays the content of the clipboard 156 | * 157 | * @return void 158 | */ 159 | public function clipboardAction() { 160 | /** @var $clipboard \TYPO3\CMS\Backend\Clipboard\Clipboard */ 161 | $clipboard = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Clipboard\\Clipboard'); 162 | // Read the clipboard content from the user session 163 | $clipboard->initializeClipboard(); 164 | // Uncomment to produce debug output 165 | // \TYPO3\CMS\Core\Utility\DebugUtility::debug($clipboard->clipData); 166 | 167 | // Access files and pages content of current pad 168 | $currentPad = array( 169 | 'files' => $clipboard->elFromTable('_FILE'), 170 | 'pages' => $clipboard->elFromTable('pages'), 171 | ); 172 | 173 | // Switch to normal pad and retrieve files and pages content 174 | $clipboard->setCurrentPad('normal'); 175 | $normalPad = array( 176 | 'files' => $clipboard->elFromTable('_FILE'), 177 | 'pages' => $clipboard->elFromTable('pages'), 178 | ); 179 | 180 | // Pass data to the view for display 181 | $this->view->assignMultiple( 182 | array( 183 | 'current' => $currentPad, 184 | 'normal' => $normalPad 185 | ) 186 | ); 187 | } 188 | 189 | /** 190 | * Displays links to edit records 191 | * 192 | * @return void 193 | */ 194 | public function linksAction() { 195 | 196 | } 197 | } 198 | -------------------------------------------------------------------------------- /Classes/ExtDirect/Server.php: -------------------------------------------------------------------------------- 1 | 19 | * @package TYPO3 20 | * @subpackage tx_examples 21 | */ 22 | class Tx_Examples_ExtDirect_Server { 23 | 24 | /** 25 | * Returns the count of records for a table 26 | * 27 | * This method is a simple demonstration of ExtDirect call 28 | * 29 | * @param string $table Name of a TYPO3 table 30 | * @return array 31 | */ 32 | public function countRecords($table) { 33 | // Return the count of all non-deleted records for the given table 34 | return array( 35 | 'data' => $GLOBALS['TYPO3_DB']->exec_SELECTcountRows('uid', $table, '1 = 1' . \TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause($table)) 36 | ); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /Classes/Service/ContextMenuOptions.php: -------------------------------------------------------------------------------- 1 | 21 | * @package TYPO3 22 | * @subpackage tx_examples 23 | */ 24 | class ContextMenuOptions { 25 | 26 | /** 27 | * Adds a sample item to the CSM 28 | * 29 | * @param \TYPO3\CMS\Backend\ClickMenu\ClickMenu $parentObject Back-reference to the calling object 30 | * @param array $menuItems Current list of menu items 31 | * @param string $table Name of the table the clicked on item belongs to 32 | * @param integer $uid Id of the clicked on item 33 | * 34 | * @return array Modified list of menu items 35 | */ 36 | public function main(\TYPO3\CMS\Backend\ClickMenu\ClickMenu $parentObject, $menuItems, $table, $uid) { 37 | // Activate the menu item only for "pages" table 38 | if ($table === 'pages') { 39 | // URL for the menu item. Point to the page tree example module, passing the page id. 40 | $baseUrl = \TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl( 41 | 'tools_ExamplesExamples', 42 | array( 43 | 'tx_examples_tools_examplesexamples[action]' => 'tree', 44 | 'tx_examples_tools_examplesexamples[controller]' => 'Default', 45 | 'tx_examples_tools_examplesexamples[page]' => $uid 46 | ) 47 | ); 48 | 49 | // Add new menu item with the following parameters: 50 | // 1) Label 51 | // 2) Icon 52 | // 3) URL 53 | // 4) = 1 disable item in docheader 54 | $menuItems[] = $parentObject->linkItem( 55 | $GLOBALS['LANG']->sL('LLL:EXT:examples/Resources/Private/Language/locallang.xml:csm_view_page'), 56 | \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('extensions-examples-page-tree'), 57 | $parentObject->urlRefForCM($baseUrl), 58 | 1 59 | ); 60 | } 61 | return $menuItems; 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /Classes/Service/RteTransformation.php: -------------------------------------------------------------------------------- 1 | 21 | * @package TYPO3 22 | * @subpackage tx_examples 23 | */ 24 | class RteTransformation { 25 | /** 26 | * NOTE: must be public as it is accessed by \TYPO3\CMS\Core\Html\RteHtmlParser without API 27 | * 28 | * @var \TYPO3\CMS\Core\Html\RteHtmlParser 29 | */ 30 | public $pObj; 31 | 32 | /** 33 | * NOTE: must be public as it is accessed by \TYPO3\CMS\Core\Html\RteHtmlParser without API 34 | * 35 | * @var string 36 | */ 37 | public $transformationKey = 'tx_examples_transformation'; 38 | 39 | /** 40 | * @var array 41 | */ 42 | protected $configuration; 43 | 44 | /** 45 | * Loads the transformation's configuration 46 | * 47 | * @return void 48 | */ 49 | protected function loadConfiguration() { 50 | $this->configuration = $this->pObj->procOptions['usertrans.'][$this->transformationKey . '.']; 51 | } 52 | 53 | /** 54 | * Transforms RTE content prior to database storage 55 | * 56 | * @param string $value RTE HTML to clean for database storage 57 | * @return string 58 | */ 59 | public function transform_db($value) { 60 | $this->loadConfiguration(); 61 | 62 | if ($this->configuration['addHrulerInRTE']) { 63 | $value = preg_replace('/[[:space:]]*$/i', '', $value); 64 | } 65 | 66 | return $value; 67 | } 68 | 69 | /** 70 | * Transforms database content for RTE display 71 | * 72 | * @param string $value Database content to transform into RTE-ready HTML 73 | * @return string 74 | */ 75 | public function transform_rte($value) { 76 | $this->loadConfiguration(); 77 | 78 | if ($this->configuration['addHrulerInRTE']) { 79 | $value .= '
'; 80 | } 81 | 82 | return $value; 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /Classes/Userfuncs/Tca.php: -------------------------------------------------------------------------------- 1 | 21 | * @package TYPO3 22 | * @subpackage tx_examples 23 | */ 24 | class Tca { 25 | 26 | /** 27 | * This method renders a user-defined field 28 | * 29 | * @param array $PA: parameters of the field 30 | * @param object $fObj: calling object (TCEform) 31 | * @return string HTML for the field 32 | */ 33 | public function specialField($PA, $fObj) { 34 | $color = (isset($PA['parameters']['color'])) ? $PA['parameters']['color'] : 'red'; 35 | $formField = '
'; 36 | $formField .= '' . $PA['item'] . '
'; 61 | 62 | // Assemble the wizard itself 63 | $output = '
'; 64 | 65 | $commonJavascriptCalls = $PA['fieldChangeFunc']['TBE_EDITOR_fieldChanged'] . $PA['fieldChangeFunc']['typo3form.fieldGet'] . ' return false;'; 66 | // Create the + button 67 | $onClick = "document." . $PA['formName'] . "['" . $PA['itemName'] . "'].value++; " . $commonJavascriptCalls; 68 | $output .= '+'; 69 | // Create the - button 70 | $onClick = "document." . $PA['formName'] . "['" . $PA['itemName'] . "'].value--; " . $commonJavascriptCalls; 71 | $output .= '-'; 72 | $output .= '
'; 73 | return $output; 74 | } 75 | 76 | /** 77 | * This method creates custom titles for the records of the tx_examples_haiku table 78 | * 79 | * @param array $parameters Parameters used to identify the current record 80 | * @param object $parentObject Calling object 81 | * @return void 82 | */ 83 | public function haikuTitle(&$parameters, $parentObject) { 84 | $record = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecord($parameters['table'], $parameters['row']['uid']); 85 | $newTitle = $record['title']; 86 | $newTitle .= ' (' . substr(strip_tags($record['poem']), 0, 10) . '...)'; 87 | $parameters['title'] = $newTitle; 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /Classes/Utilities/Viewport.php: -------------------------------------------------------------------------------- 1 | 19 | * @package TYPO3 20 | * @subpackage tx_examples 21 | */ 22 | class Tx_Examples_Utilities_Viewport { 23 | 24 | /** 25 | * Modifies the configuration of the TYPO3 Viewport 26 | * 27 | * This method uses a page rendering hook to change the left-hand menu's configuration 28 | * and make it collapsible 29 | * 30 | * @param array $parameters List of parameters 31 | * @param t3lib_pageRenderer $pageRenderer Back-reference to the page rendering object 32 | * @return array 33 | */ 34 | public function renderPreProcess($parameters, $pageRenderer) { 35 | $pageRenderer->addExtOnReadyCode(' 36 | Ext.apply(TYPO3.Viewport.configuration.items[1], { 37 | split: true, 38 | collapsible: true, 39 | collapseMode: "mini", 40 | hideCollapseTool: true, 41 | animCollapse: false 42 | });', 43 | true 44 | ); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /Classes/ViewHelpers/Be/EditLinkViewHelper.php: -------------------------------------------------------------------------------- 1 | 23 | * 24 | * 25 | * 26 | * ... 27 | * 28 | * 29 | * @author Francois Suter (Cobweb) 30 | * @package TYPO3 31 | * @subpackage tx_examples 32 | */ 33 | class EditLinkViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\AbstractTagBasedViewHelper { 34 | 35 | /** 36 | * @var string 37 | */ 38 | protected $tagName = 'a'; 39 | 40 | /** 41 | * Initialize arguments 42 | * 43 | * @return void 44 | * @api 45 | */ 46 | public function initializeArguments() { 47 | $this->registerUniversalTagAttributes(); 48 | $this->registerTagAttribute('name', 'string', 'Specifies the name of an anchor'); 49 | $this->registerTagAttribute('target', 'string', 'Specifies where to open the linked document'); 50 | } 51 | 52 | /** 53 | * Crafts a link to edit a database record or create a new one 54 | * 55 | * @param string $parameters Query string parameters 56 | * @param string $returnUrl URL to return to 57 | * @return string The tag 58 | * @see \TYPO3\CMS\Backend\Utility::editOnClick() 59 | */ 60 | public function render($parameters, $returnUrl = '') { 61 | $uri = 'alt_doc.php?' . $parameters; 62 | if (!empty($returnUrl)) { 63 | $uri .= '&returnUrl=' . rawurlencode($returnUrl); 64 | } 65 | 66 | $this->tag->addAttribute('href', $uri); 67 | $this->tag->setContent($this->renderChildren()); 68 | $this->tag->forceClosingTag(TRUE); 69 | return $this->tag->render(); 70 | } 71 | } 72 | 73 | -------------------------------------------------------------------------------- /Classes/ViewHelpers/Be/HeaderViewHelper.php: -------------------------------------------------------------------------------- 1 | 21 | * @package TYPO3 22 | * @subpackage tx_examples 23 | */ 24 | class HeaderViewHelper extends \TYPO3\CMS\Fluid\ViewHelpers\Be\AbstractBackendViewHelper { 25 | 26 | /** 27 | * Renders the view helper 28 | * 29 | * In this case, it actually renders nothing, but only loads stuff in the page header 30 | * 31 | * @return void 32 | */ 33 | public function render() { 34 | $pageRenderer = $this->getDocInstance()->getPageRenderer(); 35 | 36 | // Add base ExtDirect code 37 | $pageRenderer->addExtDirectCode( 38 | array('TYPO3.Examples') 39 | ); 40 | // Make localized labels available in JavaScript context 41 | $pageRenderer->addInlineLanguageLabelFile('EXT:examples/Resources/Private/Language/locallang.xml'); 42 | 43 | // Load application specific JS 44 | $pageRenderer->addJsFile( 45 | \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('examples') . 'Resources/Public/JavaScript/Application.js', 46 | 'text/javascript', 47 | FALSE 48 | ); 49 | } 50 | } 51 | 52 | -------------------------------------------------------------------------------- /Classes/ViewHelpers/Be/IconViewHelper.php: -------------------------------------------------------------------------------- 1 | 23 | * 24 | * 25 | * 26 | *   27 | * 28 | * 29 | * @author Francois Suter (Cobweb) 30 | * @package TYPO3 31 | * @subpackage tx_examples 32 | */ 33 | class IconViewHelper extends \TYPO3\CMS\Fluid\ViewHelpers\Be\AbstractBackendViewHelper { 34 | 35 | /** 36 | * Renders an icon based on the TYPO3 backend sprite 37 | * 38 | * @param string $icon Icon to be used 39 | * @param string $title Image title 40 | * @return string The rendered icon 41 | */ 42 | public function render($icon, $title = '') { 43 | return \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon( 44 | $icon, 45 | array('title' => $title) 46 | ); 47 | } 48 | } 49 | 50 | -------------------------------------------------------------------------------- /Classes/Xclass/NewRecordController.php: -------------------------------------------------------------------------------- 1 | 21 | * @package TYPO3 22 | * @subpackage tx_examples 23 | */ 24 | class NewRecordController extends \TYPO3\CMS\Backend\Controller\NewRecordController { 25 | /** 26 | * This methods adds a section at the bottom of the New Record Wizard 27 | * 28 | * USAGE: Core APIs > TYPO3 API overview > PHP Class Extension > Which classes? > Example - Adding a small feature in the interface 29 | * 30 | * @return void 31 | */ 32 | function regularNew() { 33 | parent::regularNew(); 34 | $this->code .= $this->doc->section( 35 | $GLOBALS['LANG']->sL('LLL:EXT:examples/Resources/Private/Language/locallang.xlf:help'), 36 | $GLOBALS['LANG']->sL('LLL:EXT:examples/Resources/Private/Language/locallang.xlf:make_choice'), 37 | 0, 38 | 1 39 | ); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /Configuration/Flexforms/flexform_ds1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 1 4 | 5 | 6 | 7 | 8 | 9 | LLL:EXT:examples/Resources/Private/Language/locallang_db.xlf:examples.pi_flexform.sheetGeneral 10 | 11 | array 12 | 13 | 14 | 15 | 16 | 17 | select 18 | 19 | 20 | LLL:EXT:examples/Resources/Private/Language/locallang_db.xlf:examples.pi_flexform.choosePage 21 | 0 22 | 23 | 24 | pages 25 | ORDER BY title 26 | 0 27 | 1 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /Configuration/Flexforms/flexform_ds2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 1 4 | 5 | 6 | 7 | 8 | 9 | LLL:EXT:examples/Resources/Private/Language/locallang_db.xlf:examples.pi_flexform.sheetGeneral 10 | 11 | array 12 | 13 | 14 | 15 | 16 | 17 | select 18 | 19 | 20 | LLL:EXT:examples/Resources/Private/Language/locallang_db.xlf:examples.pi_flexform.choosePage 21 | 0 22 | 23 | 24 | pages 25 | ORDER BY title 26 | 0 27 | 1 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | LLL:EXT:examples/Resources/Private/Language/locallang_db.xlf:examples.pi_flexform.s_Message 38 | 39 | array 40 | 41 |
42 | 43 | 44 | 45 | input 46 | 30 47 | 48 | 49 |
50 | 51 | 52 | 53 | 54 | text 55 | 40 56 | 5 57 | 58 | 59 | 60 |
61 |
62 |
63 |
64 |
-------------------------------------------------------------------------------- /Configuration/Flexforms/flexform_ds3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 0 4 | 5 | 6 | 7 | 8 | 9 | LLL:EXT:examples/Resources/Private/Language/locallang_db.xlf:examples.pi_flexform.sheetGeneral 10 | 11 | array 12 | 13 | 14 | 15 | 16 | 17 | select 18 | 19 | 20 | LLL:EXT:examples/Resources/Private/Language/locallang_db.xlf:examples.pi_flexform.choosePage 21 | 0 22 | 23 | 24 | pages 25 | ORDER BY title 26 | 0 27 | 1 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | LLL:EXT:examples/Resources/Private/Language/locallang_db.xlf:examples.pi_flexform.s_Message 38 | 39 | array 40 | 41 |
42 | 43 | 44 | 45 | input 46 | 30 47 | 48 | 49 |
50 | 51 | 52 | 53 | 54 | text 55 | 40 56 | 5 57 | 58 | 59 | 60 |
61 |
62 |
63 |
64 |
-------------------------------------------------------------------------------- /Configuration/Flexforms/flexform_ds4.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 0 4 | 1 5 | 6 | 7 | 8 | 9 | 10 | LLL:EXT:examples/Resources/Private/Language/locallang_db.xlf:examples.pi_flexform.sheetGeneral 11 | 12 | array 13 | 14 | 15 | 16 | 17 | 18 | select 19 | 20 | 21 | LLL:EXT:examples/Resources/Private/Language/locallang_db.xlf:examples.pi_flexform.choosePage 22 | 0 23 | 24 | 25 | pages 26 | ORDER BY title 27 | 0 28 | 1 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | LLL:EXT:examples/Resources/Private/Language/locallang_db.xlf:examples.pi_flexform.s_Message 39 | 40 | array 41 | 42 |
43 | 44 | 45 | 46 | input 47 | 30 48 | 49 | 50 |
51 | 52 | 53 | 54 | 55 | text 56 | 40 57 | 5 58 | 59 | 60 | 61 |
62 |
63 |
64 |
65 |
-------------------------------------------------------------------------------- /Configuration/TCA/Overrides/fe_users.php: -------------------------------------------------------------------------------- 1 | $TCA array reference > ['columns'][fieldname]['config'] / TYPE: "select" 6 | $temporaryColumns = array ( 7 | 'tx_examples_options' => array ( 8 | 'exclude' => 0, 9 | 'label' => 'LLL:EXT:examples/Resources/Private/Language/locallang_db.xlf:fe_users.tx_examples_options', 10 | 'config' => array ( 11 | 'type' => 'select', 12 | 'items' => array ( 13 | array('LLL:EXT:examples/Resources/Private/Language/locallang_db.xlf:fe_users.tx_examples_options.I.0', '1'), 14 | array('LLL:EXT:examples/Resources/Private/Language/locallang_db.xlf:fe_users.tx_examples_options.I.1', '2'), 15 | array('LLL:EXT:examples/Resources/Private/Language/locallang_db.xlf:fe_users.tx_examples_options.I.2', '--div--'), 16 | array('LLL:EXT:examples/Resources/Private/Language/locallang_db.xlf:fe_users.tx_examples_options.I.3', '3'), 17 | ), 18 | 'size' => 1, 19 | 'maxitems' => 1, 20 | ) 21 | ), 22 | 'tx_examples_special' => array ( 23 | 'exclude' => 0, 24 | 'label' => 'LLL:EXT:examples/Resources/Private/Language/locallang_db.xlf:fe_users.tx_examples_special', 25 | 'config' => array ( 26 | 'type' => 'user', 27 | 'size' => '30', 28 | 'userFunc' => 'Documentation\\Examples\\Userfuncs\\Tca->specialField', 29 | 'parameters' => array( 30 | 'color' => 'blue' 31 | ) 32 | ) 33 | ), 34 | ); 35 | 36 | \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns( 37 | 'fe_users', 38 | $temporaryColumns, 39 | TRUE 40 | ); 41 | 42 | \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes( 43 | 'fe_users', 44 | 'tx_examples_options;;;;1-1-1, tx_examples_special' 45 | ); -------------------------------------------------------------------------------- /Configuration/TCA/Overrides/pages.php: -------------------------------------------------------------------------------- 1 | $TCA array reference > ['columns'][field name]['config'] / TYPE: "select" 6 | $tempConfiguration = array( 7 | 'type' => 'select', 8 | 'foreign_table' => 'pages', 9 | 'size' => 10, 10 | 'renderMode' => 'tree', 11 | 'treeConfig' => array( 12 | 'expandAll' => true, 13 | 'parentField' => 'pid', 14 | 'appearance' => array( 15 | 'showHeader' => TRUE, 16 | ), 17 | ), 18 | ); 19 | 20 | $GLOBALS['TCA']['pages']['columns']['storage_pid']['config'] = array_merge( 21 | $GLOBALS['TCA']['pages']['columns']['storage_pid']['config'], 22 | $tempConfiguration 23 | ); 24 | 25 | // Add an extra categories selection field to the pages table 26 | \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::makeCategorizable( 27 | 'examples', 28 | 'pages', 29 | // Do not use the default field name ("categories"), which is already used 30 | // Also do not use a field name containing "categories" (see http://forum.typo3.org/index.php/t/199595/) 31 | 'tx_examples_cats', 32 | array( 33 | // Set a custom label 34 | 'label' => 'LLL:EXT:examples/Resources/Private/Language/locallang.xlf:additional_categories', 35 | // This field should not be an exclude-field 36 | 'exclude' => FALSE, 37 | // Override generic configuration, e.g. sort by title rather than by sorting 38 | 'fieldConfiguration' => array( 39 | 'foreign_table_where' => ' AND sys_category.sys_language_uid IN (-1, 0) ORDER BY sys_category.title ASC', 40 | ) 41 | ) 42 | ); -------------------------------------------------------------------------------- /Configuration/TCA/Overrides/tt_content.php: -------------------------------------------------------------------------------- 1 | $TCA array reference > Extending the $TCA array 6 | $temporaryColumn = array( 7 | 'tx_examples_noprint' => array ( 8 | 'exclude' => 0, 9 | 'label' => 'LLL:EXT:examples/Resources/Private/Language/locallang_db.xlf:tt_content.tx_examples_noprint', 10 | 'config' => array ( 11 | 'type' => 'check', 12 | ) 13 | ) 14 | ); 15 | 16 | \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns( 17 | 'tt_content', 18 | $temporaryColumn, 19 | TRUE 20 | ); 21 | 22 | \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addFieldsToPalette( 23 | 'tt_content', 24 | 'visibility', 25 | 'tx_examples_noprint', 26 | 'after:linkToTop' 27 | ); -------------------------------------------------------------------------------- /Configuration/TCA/tx_examples_dummy.php: -------------------------------------------------------------------------------- 1 | array( 4 | 'title' => 'LLL:EXT:examples/Resources/Private/Language/locallang_db.xlf:tx_examples_dummy', 5 | 'label' => 'title', 6 | 'tstamp' => 'tstamp', 7 | 'crdate' => 'crdate', 8 | 'cruser_id' => 'cruser_id', 9 | 'type' => 'record_type', 10 | 'default_sortby' => 'ORDER BY title', 11 | 'delete' => 'deleted', 12 | 'enablecolumns' => array( 13 | 'disabled' => 'hidden', 14 | ), 15 | 'typeicon_classes' => array( 16 | 'default' => 'extensions-examples-dummy-default' 17 | ) 18 | ), 19 | 'columns' => array( 20 | 'hidden' => array( 21 | 'exclude' => 1, 22 | 'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.hidden', 23 | 'config' => array( 24 | 'type' => 'check', 25 | 'default' => '0' 26 | ) 27 | ), 28 | 'record_type' => array( 29 | 'exclude' => 0, 30 | 'label' => 'LLL:EXT:examples/Resources/Private/Language/locallang_db.xlf:tx_examples_dummy.record_type', 31 | 'config' => array( 32 | 'type' => 'select', 33 | 'items' => array( 34 | array('LLL:EXT:examples/Resources/Private/Language/locallang_db.xlf:tx_examples_dummy.record_type.0', 0), 35 | array('LLL:EXT:examples/Resources/Private/Language/locallang_db.xlf:tx_examples_dummy.record_type.1', 1), 36 | array('LLL:EXT:examples/Resources/Private/Language/locallang_db.xlf:tx_examples_dummy.record_type.2', 2), 37 | ) 38 | ) 39 | ), 40 | 'title' => array( 41 | 'exclude' => 0, 42 | 'label' => 'LLL:EXT:examples/Resources/Private/Language/locallang_db.xlf:tx_examples_dummy.title', 43 | 'config' => array( 44 | 'type' => 'input', 45 | 'size' => 30, 46 | 'eval' => 'required,trim', 47 | ) 48 | ), 49 | 'some_date' => array( 50 | 'exclude' => 0, 51 | 'label' => 'LLL:EXT:examples/Resources/Private/Language/locallang_db.xlf:tx_examples_dummy.some_date', 52 | 'config' => array( 53 | 'type' => 'input', 54 | 'size' => 12, 55 | 'eval' => 'date', 56 | ) 57 | ), 58 | 'enforce_date' => array( 59 | 'exclude' => 0, 60 | 'label' => 'LLL:EXT:examples/Resources/Private/Language/locallang_db.xlf:tx_examples_dummy.enforce_date', 61 | 'config' => array( 62 | 'type' => 'check', 63 | ) 64 | ), 65 | 'description' => array( 66 | 'exclude' => 0, 67 | 'label' => 'LLL:EXT:examples/Resources/Private/Language/locallang_db.xlf:tx_examples_dummy.description', 68 | 'config' => array( 69 | 'type' => 'text', 70 | 'cols' => 50, 71 | 'rows' => 3 72 | ) 73 | ) 74 | ), 75 | 'types' => array( 76 | // NOTE: there are alternate versions of this row to demonstrate various features 77 | // '0' => array('showitem' => 'hidden, record_type, title, some_date '), 78 | // Use this row to demonstrate usage of palettes 79 | '0' => array('showitem' => 'hidden, record_type, title, some_date;;1 '), 80 | // Use this row when discussing special configuration nowrap 81 | // (paste this into the description field: This is a very long text that will not wrap when I get to the end of the box, which is very far away, away, away, away, away, away) 82 | // '0' => array('showitem' => 'hidden, record_type, title, description;;;nowrap, some_date;;1 '), 83 | // Additional types 84 | '1' => array('showitem' => 'record_type, title '), 85 | '2' => array('showitem' => 'title, some_date, hidden, record_type '), 86 | ), 87 | 'palettes' => array( 88 | '1' => array('showitem' => 'enforce_date'), 89 | ), 90 | ); 91 | -------------------------------------------------------------------------------- /Configuration/TCA/tx_examples_haiku.php: -------------------------------------------------------------------------------- 1 | array( 4 | 'title' => 'LLL:EXT:examples/Resources/Private/Language/locallang_db.xlf:tx_examples_haiku', 5 | 'label' => 'title', 6 | 'label_userFunc' => 'Documentation\\Examples\\Userfuncs\\Tca->haikuTitle', 7 | 'tstamp' => 'tstamp', 8 | 'crdate' => 'crdate', 9 | 'cruser_id' => 'cruser_id', 10 | 'default_sortby' => 'ORDER BY title', 11 | 'delete' => 'deleted', 12 | 'enablecolumns' => array( 13 | 'disabled' => 'hidden', 14 | ), 15 | 'searchFields' => 'title,poem', 16 | 'dividers2tabs' => TRUE, 17 | 'typeicon_classes' => array( 18 | 'default' => 'extensions-examples-haiku-default' 19 | ) 20 | ), 21 | 'interface' => array( 22 | 'showRecordFieldList' => 'title,season,angle', 23 | 'maxDBListItems' => 5, 24 | 'maxSingleDBListItems' => 20 25 | ), 26 | 'columns' => array( 27 | 'hidden' => array( 28 | 'exclude' => 1, 29 | 'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.hidden', 30 | 'config' => array( 31 | 'type' => 'check', 32 | 'default' => '0' 33 | ) 34 | ), 35 | 'title' => array( 36 | 'exclude' => 0, 37 | 'label' => 'LLL:EXT:examples/Resources/Private/Language/locallang_db.xlf:tx_examples_haiku.title', 38 | 'config' => array( 39 | 'type' => 'input', 40 | 'size' => 30, 41 | 'eval' => 'required,trim', 42 | ) 43 | ), 44 | 'poem' => array( 45 | 'exclude' => 0, 46 | 'label' => 'LLL:EXT:examples/Resources/Private/Language/locallang_db.xlf:tx_examples_haiku.poem', 47 | 'config' => array( 48 | 'type' => 'text', 49 | 'cols' => 40, 50 | 'rows' => 6, 51 | 'softref' => 'typolink_tag,images,email[subst],url', 52 | ), 53 | 'defaultExtras' => 'richtext[]:rte_transform[mode=tx_examples_transformation-ts_css]:static_write[filename|poem]' 54 | // NOTE: parameters 4 and 5 don't seem to apply, this must be broken. Investigate later. 55 | // 'defaultExtras' => 'richtext[]:static_write[filename|poem||filesource|filestatus]' 56 | ), 57 | 'filename' => array( 58 | 'exclude' => 0, 59 | 'label' => 'LLL:EXT:examples/Resources/Private/Language/locallang_db.xlf:tx_examples_haiku.filename', 60 | 'config' => array( 61 | 'type' => 'input', 62 | 'size' => 30, 63 | ) 64 | ), 65 | 'filesource' => array( 66 | 'exclude' => 0, 67 | 'label' => 'LLL:EXT:examples/Resources/Private/Language/locallang_db.xlf:tx_examples_haiku.filesource', 68 | 'config' => array( 69 | 'type' => 'check', 70 | ) 71 | ), 72 | 'filestatus' => array( 73 | 'exclude' => 0, 74 | 'label' => 'LLL:EXT:examples/Resources/Private/Language/locallang_db.xlf:tx_examples_haiku.filestatus', 75 | 'config' => array( 76 | 'type' => 'input', 77 | 'size' => 30, 78 | ) 79 | ), 80 | 'season' => array( 81 | 'exclude' => 0, 82 | 'label' => 'LLL:EXT:examples/Resources/Private/Language/locallang_db.xlf:tx_examples_haiku.season', 83 | 'config' => array( 84 | 'type' => 'input', 85 | 'size' => 20, 86 | 'eval' => 'trim', 87 | 'wizards' => array( 88 | 'season_picker' => array( 89 | 'type' => 'select', 90 | 'mode' => '', 91 | 'items' => array( 92 | array('LLL:EXT:examples/Resources/Private/Language/locallang_db.xlf:tx_examples_haiku.season.spring', 'Spring'), 93 | array('LLL:EXT:examples/Resources/Private/Language/locallang_db.xlf:tx_examples_haiku.season.summer', 'Summer'), 94 | array('LLL:EXT:examples/Resources/Private/Language/locallang_db.xlf:tx_examples_haiku.season.autumn', 'Autumn'), 95 | array('LLL:EXT:examples/Resources/Private/Language/locallang_db.xlf:tx_examples_haiku.season.winter', 'Winter'), 96 | ) 97 | ) 98 | ) 99 | ) 100 | ), 101 | 'weirdness' => array( 102 | 'exclude' => 0, 103 | 'label' => 'LLL:EXT:examples/Resources/Private/Language/locallang_db.xlf:tx_examples_haiku.weirdness', 104 | 'config' => array( 105 | 'type' => 'input', 106 | 'size' => 10, 107 | 'eval' => 'int', 108 | 'wizards' => array( 109 | 'specialWizard' => array( 110 | 'type' => 'userFunc', 111 | 'userFunc' => 'Documentation\\Examples\\Userfuncs\\Tca->someWizard', 112 | 'params' => array( 113 | 'color' => 'green' 114 | ) 115 | ) 116 | ) 117 | ) 118 | ), 119 | 'color' => array( 120 | 'exclude' => 0, 121 | 'label' => 'LLL:EXT:examples/Resources/Private/Language/locallang_db.xlf:tx_examples_haiku.color', 122 | 'config' => array( 123 | 'type' => 'input', 124 | 'size' => 10, 125 | 'eval' => 'trim', 126 | 'wizards' => array( 127 | 'colorChoice' => array( 128 | 'type' => 'colorbox', 129 | 'title' => 'LLL:EXT:examples/Resources/Private/Language/locallang_db.xlf:tx_examples_haiku.colorPick', 130 | // Pre-TYPO3 6.2, use "script" property 131 | // 'script' => 'wizard_colorpicker.php', 132 | 'module' => array( 133 | 'name' => 'wizard_colorpicker', 134 | ), 135 | 'dim' => '20x20', 136 | 'tableStyle' => 'border: solid 1px black; margin-left: 20px;', 137 | 'JSopenParams' => 'height=600,width=380,status=0,menubar=0,scrollbars=1', 138 | 'exampleImg' => 'EXT:examples/Resources/Public/Images/JapaneseGarden.jpg', 139 | ) 140 | ) 141 | ) 142 | ), 143 | 'angle' => array( 144 | 'exclude' => 0, 145 | 'label' => 'LLL:EXT:examples/Resources/Private/Language/locallang_db.xlf:tx_examples_haiku.angle', 146 | 'config' => array( 147 | 'type' => 'input', 148 | 'size' => 5, 149 | 'eval' => 'trim,int', 150 | 'range' => array( 151 | 'lower' => -90, 152 | 'upper' => 90 153 | ), 154 | 'default' => 0, 155 | 'wizards' => array( 156 | 'angle' => array( 157 | 'type' => 'slider', 158 | 'step' => 10, 159 | 'width' => 200 160 | ) 161 | ) 162 | ) 163 | ), 164 | // USAGE: TCA reference > $TCA array reference > ['columns'][fieldname]['config'] / TYPE: "group" 165 | // Demonstrates the various values the property disable_controls can take 166 | 'image1' => array( 167 | 'label' => 'LLL:EXT:examples/Resources/Private/Language/locallang_db.xlf:tx_examples_haiku.image1', 168 | 'config' => array( 169 | 'type' => 'group', 170 | 'internal_type' => 'file', 171 | 'allowed' => $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'], 172 | 'max_size' => $GLOBALS['TYPO3_CONF_VARS']['BE']['maxFileSize'], 173 | 'uploadfolder' => 'uploads/pics', 174 | 'show_thumbs' => '1', 175 | 'size' => '3', 176 | 'maxitems' => '200', 177 | 'minitems' => '0', 178 | 'autoSizeMax' => 40, 179 | ), 180 | ), 181 | 'image2' => array( 182 | 'label' => 'LLL:EXT:examples/Resources/Private/Language/locallang_db.xlf:tx_examples_haiku.image2', 183 | 'config' => array( 184 | 'type' => 'group', 185 | 'internal_type' => 'file', 186 | 'allowed' => $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'], 187 | 'max_size' => $GLOBALS['TYPO3_CONF_VARS']['BE']['maxFileSize'], 188 | 'uploadfolder' => 'uploads/pics', 189 | 'show_thumbs' => '1', 190 | 'size' => '3', 191 | 'maxitems' => '200', 192 | 'minitems' => '0', 193 | 'autoSizeMax' => 40, 194 | 'disable_controls' => 'browser' 195 | ), 196 | ), 197 | 'image3' => array( 198 | 'label' => 'LLL:EXT:examples/Resources/Private/Language/locallang_db.xlf:tx_examples_haiku.image3', 199 | 'config' => array( 200 | 'type' => 'group', 201 | 'internal_type' => 'file', 202 | 'allowed' => $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'], 203 | 'max_size' => $GLOBALS['TYPO3_CONF_VARS']['BE']['maxFileSize'], 204 | 'uploadfolder' => 'uploads/pics', 205 | 'show_thumbs' => '1', 206 | 'size' => '3', 207 | 'maxitems' => '200', 208 | 'minitems' => '0', 209 | 'autoSizeMax' => 40, 210 | 'disable_controls' => 'upload' 211 | ), 212 | ), 213 | 'image4' => array( 214 | 'label' => 'LLL:EXT:examples/Resources/Private/Language/locallang_db.xlf:tx_examples_haiku.image4', 215 | 'config' => array( 216 | 'type' => 'group', 217 | 'internal_type' => 'file', 218 | 'allowed' => $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'], 219 | 'max_size' => $GLOBALS['TYPO3_CONF_VARS']['BE']['maxFileSize'], 220 | 'uploadfolder' => 'uploads/pics', 221 | 'show_thumbs' => '1', 222 | 'size' => '3', 223 | 'maxitems' => '200', 224 | 'minitems' => '0', 225 | 'autoSizeMax' => 40, 226 | 'disable_controls' => 'list' 227 | ), 228 | ), 229 | 'image5' => array( 230 | 'label' => 'LLL:EXT:examples/Resources/Private/Language/locallang_db.xlf:tx_examples_haiku.image5', 231 | 'config' => array( 232 | 'type' => 'group', 233 | 'internal_type' => 'file', 234 | 'allowed' => $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'], 235 | 'max_size' => $GLOBALS['TYPO3_CONF_VARS']['BE']['maxFileSize'], 236 | 'uploadfolder' => 'uploads/pics', 237 | 'show_thumbs' => '1', 238 | 'size' => '3', 239 | 'maxitems' => '200', 240 | 'minitems' => '0', 241 | 'autoSizeMax' => 40, 242 | 'disable_controls' => 'delete' 243 | ), 244 | ), 245 | 'image6' => array( 246 | 'label' => 'LLL:EXT:examples/Resources/Private/Language/locallang_db.xlf:tx_examples_haiku.image6', 247 | 'config' => array( 248 | 'type' => 'group', 249 | 'internal_type' => 'file', 250 | 'allowed' => $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'], 251 | 'max_size' => $GLOBALS['TYPO3_CONF_VARS']['BE']['maxFileSize'], 252 | 'uploadfolder' => 'uploads/pics', 253 | 'show_thumbs' => '1', 254 | 'size' => '3', 255 | 'maxitems' => '200', 256 | 'minitems' => '0', 257 | 'autoSizeMax' => 40, 258 | 'disable_controls' => 'browser,upload,list,delete' 259 | ), 260 | ), 261 | 'image_fal_group' => array( 262 | 'label' => 'LLL:EXT:examples/Resources/Private/Language/locallang_db.xlf:tx_examples_haiku.image_fal_group', 263 | 'config' => array( 264 | 'type' => 'group', 265 | 'internal_type' => 'db', 266 | 'allowed' => 'sys_file', 267 | 'MM' => 'sys_file_reference', 268 | 'MM_match_fields' => array( 269 | 'fieldname' => 'image_fal_group' 270 | ), 271 | 'prepend_tname' => TRUE, 272 | 'appearance' => array( 273 | 'elementBrowserAllowed' => $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'], 274 | 'elementBrowserType' => 'file' 275 | ), 276 | 'max_size' => $GLOBALS['TYPO3_CONF_VARS']['BE']['maxFileSize'], 277 | 'show_thumbs' => '1', 278 | 'size' => '3', 279 | 'maxitems' => '200', 280 | 'minitems' => '0', 281 | 'autoSizeMax' => 40, 282 | ), 283 | ), 284 | 'image_fal_irre' => array( 285 | 'label' => 'LLL:EXT:examples/Resources/Private/Language/locallang_db.xlf:tx_examples_haiku.image_fal_irre', 286 | 'config' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig( 287 | 'image_fal_irre' 288 | ), 289 | ), 290 | // USAGE: TCA reference > $TCA array reference > ['columns'][fieldname]['config'] / TYPE: "select" > Examples 291 | // Use the following TSconfig to show the effect: 292 | // TCEFORM.tx_examples_haiku.reference_page.PAGE_TSCONFIG_STR = image 293 | 'reference_page' => array( 294 | 'label' => 'LLL:EXT:examples/Resources/Private/Language/locallang_db.xlf:tx_examples_haiku.reference_page', 295 | 'config' => array( 296 | 'type' => 'select', 297 | 'foreign_table' => 'pages', 298 | 'foreign_table_where' => "AND pages.title LIKE '%###PAGE_TSCONFIG_STR###%'", 299 | 'size' => 1, 300 | 'minitems' => 0, 301 | 'maxitems' => 1 302 | ), 303 | ), 304 | 'related_records' => array( 305 | 'label' => 'LLL:EXT:examples/Resources/Private/Language/locallang_db.xlf:tx_examples_haiku.related_records', 306 | 'config' => array( 307 | 'type' => 'group', 308 | 'internal_type' => 'db', 309 | 'allowed' => 'pages, tt_content', 310 | 'size' => 5, 311 | 'minitems' => 0, 312 | 'maxitems' => 10, 313 | 'wizards' => array( 314 | 'suggest' => array( 315 | 'type' => 'suggest', 316 | 'default' => array( 317 | 'searchWholePhrase' => 1 318 | ), 319 | 'pages' => array( 320 | 'searchCondition' => 'doktype = 1' 321 | ) 322 | ) 323 | ) 324 | ) 325 | ), 326 | 'related_content' => array( 327 | 'label' => 'LLL:EXT:examples/Resources/Private/Language/locallang_db.xlf:tx_examples_haiku.related_content', 328 | 'config' => array( 329 | 'type' => 'select', 330 | 'foreign_table' => 'tt_content', 331 | 'foreign_table_where' => 'ORDER BY header ASC', 332 | 'size' => 5, 333 | 'minitems' => 0, 334 | 'maxitems' => 999, 335 | 'enableMultiSelectFilterTextfield' => TRUE, 336 | 'multiSelectFilterItems' => array( 337 | array( 338 | 'image', 339 | 'LLL:EXT:examples/Resources/Private/Language/locallang_db.xlf:tx_examples_haiku.related_content.image' 340 | ), 341 | array( 342 | 'typo3', 343 | 'LLL:EXT:examples/Resources/Private/Language/locallang_db.xlf:tx_examples_haiku.related_content.typo3' 344 | ), 345 | ) 346 | ) 347 | ) 348 | ), 349 | 'types' => array( 350 | '0' => array('showitem' => 'hidden;;;;1-1-1, title;;;;2-2-2, poem, filename;;;;3-3-3, season;;;;4-4-4, weirdness, color, angle, --div--;LLL:EXT:examples/Resources/Private/Language/locallang_db.xlf:tx_examples_haiku.images, image1, image2, image3, image4, image5, image6, --div--;LLL:EXT:examples/Resources/Private/Language/locallang_db.xlf:tx_examples_haiku.images_fal, image_fal_group, image_fal_irre, --div--;LLL:EXT:examples/Resources/Private/Language/locallang_db.xlf:tx_examples_haiku.relations, reference_page, related_records, related_content'), 351 | // NOTE: since filestatus is not used yet, let's not show it, nor the palette with filesource, 352 | // but it should be made to work at some point (bug in the Core?) 353 | // '0' => array('showitem' => 'hidden;;;;1-1-1, title;;;;2-2-2, poem, filename;;1;;3-3-3, filestatus, season;;;;4-4-4, weirdness, color'), 354 | ), 355 | /* 356 | * NOTE: use the filesource flag only when the problems of static_write have been solved 357 | 'palettes' => array( 358 | '1' => array('showitem' => 'filesource'), 359 | ), 360 | */ 361 | ); 362 | -------------------------------------------------------------------------------- /Configuration/TypoScript/setup.txt: -------------------------------------------------------------------------------- 1 | # Implement "no print" checkbox 2 | # USAGE: TCA Reference > $TCA array reference > Extending the $TCA array 3 | tt_content.stdWrap.outerWrap =
|
4 | tt_content.stdWrap.outerWrap.if.isTrue.field = tx_examples_noprint 5 | 6 | -------------------------------------------------------------------------------- /Documentation/.gitignore: -------------------------------------------------------------------------------- 1 | ######################### 2 | # Git 3 | # global ignore file 4 | ######################## 5 | # ignoring temporary files (left by e.g. vim) 6 | # ignoring by common IDE's used directories/files 7 | # dont ignore .rej and .orig as we want to see/clean files after conflict resolution 8 | # 9 | # for local exclude patterns please edit .git/info/exclude 10 | # 11 | *~ 12 | *.bak 13 | *.idea 14 | *.project 15 | *.swp 16 | .buildpath 17 | .cache 18 | .project 19 | .session 20 | .settings 21 | .TemporaryItems 22 | .webprj 23 | nbproject 24 | -------------------------------------------------------------------------------- /Documentation/Images/FlashMessages.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TYPO3-extensions/examples/5f87aa1d6648da6a7b56026d2d9f4d4740d5003d/Documentation/Images/FlashMessages.png -------------------------------------------------------------------------------- /Documentation/Includes.txt: -------------------------------------------------------------------------------- 1 | .. ================================================== 2 | .. FOR YOUR INFORMATION 3 | .. -------------------------------------------------- 4 | .. -*- coding: utf-8 -*- with BOM. 5 | 6 | .. This is 'Includes.txt'. It is included at the very top of each and 7 | every ReST source file in this documentation project (= manual). 8 | 9 | 10 | .. ================================================== 11 | .. DEFINE SOME TEXT ROLES 12 | .. -------------------------------------------------- 13 | 14 | .. role:: typoscript(code) 15 | 16 | .. role:: ts(typoscript) 17 | :class: typoscript 18 | 19 | .. role:: php(code) 20 | -------------------------------------------------------------------------------- /Documentation/Index.rst: -------------------------------------------------------------------------------- 1 | .. include:: Images.txt 2 | 3 | .. ================================================== 4 | .. FOR YOUR INFORMATION 5 | .. -------------------------------------------------- 6 | .. -*- coding: utf-8 -*- with BOM. 7 | 8 | .. include:: Includes.txt 9 | 10 | .. _start: 11 | 12 | ================================ 13 | Core Documentation Code Examples 14 | ================================ 15 | 16 | .. only:: html 17 | 18 | :Language: 19 | en 20 | 21 | :Version: 22 | |release| 23 | 24 | :Description: 25 | General TYPO3 CMS code examples. Used in particular for maintaining the official documentation. 26 | 27 | :Keywords: 28 | examples, tutorial, documentation 29 | 30 | :Copyright: 31 | 2013 32 | 33 | :Author: 34 | TYPO3 Documentation Team 35 | 36 | :Email: 37 | documentation@typo3.org 38 | 39 | :License: 40 | This document is published under the Open Content License 41 | available from http://www.opencontent.org/opl.shtml 42 | 43 | :Rendered: 44 | |today| 45 | 46 | 47 | .. toctree:: 48 | :maxdepth: 5 49 | :titlesonly: 50 | :glob: 51 | 52 | Introduction/Index 53 | Users/Index 54 | Maintainers/Index 55 | 56 | -------------------------------------------------------------------------------- /Documentation/Introduction/Index.rst: -------------------------------------------------------------------------------- 1 | .. ================================================== 2 | .. FOR YOUR INFORMATION 3 | .. -------------------------------------------------- 4 | .. -*- coding: utf-8 -*- with BOM. 5 | 6 | .. include:: ../Includes.txt 7 | 8 | 9 | .. _introduction: 10 | 11 | Introduction 12 | ------------ 13 | 14 | 15 | .. _introduction-what: 16 | 17 | What does it do? 18 | ^^^^^^^^^^^^^^^^ 19 | 20 | This extension contains a lot of code samples that are used throughout 21 | the TYPO3 Core Documentation. The goals are two-fold: 22 | 23 | #. provide an easy way for users to gain access to these examples for 24 | their own use. 25 | 26 | #. store all code examples in a central place, so that it is easier for 27 | documentation maintainers to reproduce the examples from the 28 | documentation, in particular when refreshing the screenshots. 29 | 30 | The usage of these examples is **not** explained in this manual. It 31 | is explained in the relevant documentation. 32 | 33 | Not all code examples from the Core Documentation will be moved here 34 | as it is a rather huge task. Whenever possible code samples are taken 35 | from the TYPO3 Core itself. Furthermore priority is given to those 36 | code samples that are related to screenshots. 37 | 38 | 39 | .. _introduction-status: 40 | 41 | Current status 42 | ^^^^^^^^^^^^^^ 43 | 44 | The current version was tested with TYPO3 CMS 6.2. Examples may apply 45 | to older versions, but since all examples use namespaces, porting them 46 | to versions prior to TYPO3 CMS 6.0 will require extra work. 47 | 48 | 49 | .. _introduction-credits: 50 | 51 | Credits 52 | ^^^^^^^ 53 | 54 | Some of the examples were originally created by Kasper Skårhøj. 55 | -------------------------------------------------------------------------------- /Documentation/Maintainers/ErrorHandlingDemo/Index.rst: -------------------------------------------------------------------------------- 1 | .. ================================================== 2 | .. FOR YOUR INFORMATION 3 | .. -------------------------------------------------- 4 | .. -*- coding: utf-8 -*- with BOM. 5 | 6 | .. include:: ../../Includes.txt 7 | 8 | 9 | .. _demo-error-handling: 10 | 11 | Error handling demonstration 12 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 13 | 14 | The extension provides a simple FE plugin for demonstrating error 15 | handling output in the FE. The settings related to the error handler 16 | should be changed to provide different output. It seems hard to get 17 | all the possible output, support for all possible settings may be 18 | buggy in the Core or has changed over the past and documentation 19 | should be adapted accordingly. 20 | 21 | -------------------------------------------------------------------------------- /Documentation/Maintainers/FlashMessagesDemo/Index.rst: -------------------------------------------------------------------------------- 1 | .. ================================================== 2 | .. FOR YOUR INFORMATION 3 | .. -------------------------------------------------- 4 | .. -*- coding: utf-8 -*- with BOM. 5 | 6 | .. include:: ../../Includes.txt 7 | 8 | 9 | .. _demo-error-flash: 10 | 11 | Flash messages demonstration 12 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 13 | 14 | The extension's BE module provide a screen for outputting Flash 15 | messages. Code extracts are used in Core APIs. 16 | 17 | 18 | .. figure:: ../../Images/FlashMessages.png 19 | :alt: Flash messages produced by the "Examples" BE module 20 | -------------------------------------------------------------------------------- /Documentation/Maintainers/Index.rst: -------------------------------------------------------------------------------- 1 | .. ================================================== 2 | .. FOR YOUR INFORMATION 3 | .. -------------------------------------------------- 4 | .. -*- coding: utf-8 -*- with BOM. 5 | 6 | .. include:: ../Includes.txt 7 | 8 | 9 | .. _maintainers: 10 | 11 | For documentation maintainers 12 | ----------------------------- 13 | 14 | Most of the customizations provided by the code samples contained in 15 | this example are activated by default. So don't be surprised if you 16 | find strange things here and there in your TYPO3 backend. 17 | 18 | Whenever possible, the usage of a given piece of code is described in 19 | the source code with the following type of PHP comments 20 | 21 | .. code-block:: php 22 | 23 | // USAGE: Core APIs > TYPO3 API overview > Various examples > Support for custom tables in the Page module 24 | 25 | This makes it easier to relate a given code sample to a precise place 26 | in a manual. The other way round, it should possible to search for a 27 | chapter title in the source code and find the relevant code sample. 28 | 29 | 30 | .. toctree:: 31 | :maxdepth: 5 32 | :titlesonly: 33 | :glob: 34 | 35 | ErrorHandlingDemo/Index 36 | FlashMessagesDemo/Index 37 | 38 | -------------------------------------------------------------------------------- /Documentation/Users/Index.rst: -------------------------------------------------------------------------------- 1 | .. ================================================== 2 | .. FOR YOUR INFORMATION 3 | .. -------------------------------------------------- 4 | .. -*- coding: utf-8 -*- with BOM. 5 | 6 | .. include:: ../Includes.txt 7 | 8 | 9 | .. _users: 10 | 11 | Users manual 12 | ------------ 13 | 14 | If you install this extension, a lot of changes will happen to your 15 | TYPO3 backend. Thus you should take care to install it only in a 16 | development environment, as you may otherwise run into some surprises. 17 | 18 | In various parts of the code contained in this extension, you will 19 | find PHP comments that look like this: 20 | 21 | .. code-block:: php 22 | 23 | // USAGE: TCA Reference > Additional $TCA features 24 | 25 | This points to which manual (and which part of the manual) refers to 26 | the given code sample. This will help you find where to find the 27 | related explanations. 28 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | Several icons used in this extension come from the Fugue Collection, 2 | by Yusuke Kamiyamane. 3 | 4 | http://p.yusukekamiyamane.com/ -------------------------------------------------------------------------------- /README.txt: -------------------------------------------------------------------------------- 1 | This extension provides a number of code examples used in the TYPO3 Core Documentation. 2 | 3 | Refer to the manual for more details. -------------------------------------------------------------------------------- /Resources/Private/Language/custom.xlf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
5 | 6 | 7 | Most important tile 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Resources/Private/Language/de.custom.xlf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
5 | 6 | 7 | Most important tile 8 | Wichtigster Titel 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /Resources/Private/Language/locallang.xlf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
5 | 6 | 7 | Examples 8 | 9 | 10 | Core code examples to demonstrate various features 11 | 12 | 13 | Examples 14 | 15 | 16 | Flash messages 17 | 18 | 19 | The above demonstrates Flash messages by showing one of each type. They can also come without title. 20 | 21 | 22 | It's also possible to pop flash messages in JavaScript. Click one of the buttons below to see some action. 23 | 24 | 25 | Count content elements 26 | 27 | 28 | Count pages 29 | 30 | 31 | Record count 32 | 33 | 34 | {0} record(s) in table "{1}". 35 | 36 | 37 | Create log entries 38 | 39 | 40 | This module creates several log entries every time it is loaded. Click on the button below to reload it and create more entries. 41 | 42 | 43 | Create entries 44 | 45 | 46 | Page tree 47 | 48 | 49 | This module demonstrates how a page tree can be created and displayed. 50 | 51 | 52 | Clipboard 53 | 54 | 55 | This module displays the content of the clipboard. 56 | 57 | 58 | Current clipboard pad 59 | 60 | 61 | Normal clipboard pad 62 | 63 | 64 | Files 65 | 66 | 67 | No files in this clipboard pad. 68 | 69 | 70 | Pages 71 | 72 | 73 | No pages in this clipboard pad. 74 | 75 | 76 | View page in tree 77 | 78 | 79 | Edit links 80 | 81 | 82 | This module shows how to generate links to edit records or create new ones. 83 | 84 | 85 | Edit page 1 86 | 87 | 88 | Edit page 1 (only title and hidden fields) 89 | 90 | 91 | Create a new haiku with a predefined title 92 | 93 | 94 | Custom permissions 95 | 96 | 97 | Custom permission #1 98 | 99 | 100 | This allows the user to save things. 101 | 102 | 103 | Custom permission #2 104 | 105 | 106 | Custom permission #3 107 | 108 | 109 | Collections usage 110 | 111 | 112 | Archive page 113 | 114 | 115 | Additional categories 116 | 117 | 118 | HELP 119 | 120 | 121 | - make a choice! 122 | 123 | 124 | Error display 125 | 126 | 127 | Displays error in the frontend to demonstrate error reporting in TYPO3. 128 | 129 | 130 | 131 | -------------------------------------------------------------------------------- /Resources/Private/Language/locallang_csh_txexampleshaiku.xlf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
5 | 6 | 7 | Haikus 8 | 9 | 10 | Haikus are short Japanese poems that follow a very strict structure. 11 | 12 | 13 | Use this field to hide a haiku that should not be published. 14 | 15 | 16 | Title of the haiku 17 | 18 | 19 | Text of the haiku 20 | 21 | 22 | Enter the text of your haiku in this field. 23 | 24 | 25 | 26 | The structure of the haiku is very stric. It is comprised of three "lines". Those "lines" must be made of a very precise number of "syllables": 27 | 28 | - 5 for the first line 29 | - 7 for the second line 30 | - 5 for the third line 31 | 32 | 33 | 34 | Storage file 35 | 36 | 37 | Name of the file where the text of the haiku will be stored. 38 | 39 | 40 | 41 | The file will be located in "fileadmin/static". It must already exist and be writeable. 42 | 43 | The file must contain the ###TYPO3_STATICFILE_EDIT### marker twice. The text of the haiku will be written between these two markers. Anything before and after that is ignored. 44 | 45 | 46 | 47 | Choose a season from the list or create a new season. 48 | 49 | 50 | This is a measure of weirdness. Use the wizard to increase or decrease it. 51 | 52 | 53 | Choose a color that expresses the mood of your haiku. 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /Resources/Private/Language/locallang_db.xlf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
5 | 6 | 7 | Option 1 8 | 9 | 10 | Option 2 11 | 12 | 13 | __Final options:__ 14 | 15 | 16 | Option 3 17 | 18 | 19 | Test 20 | 21 | 22 | Special field 23 | 24 | 25 | Mobile number 26 | 27 | 28 | No print 29 | 30 | 31 | Examples: simple FlexForm 32 | 33 | 34 | Examples: advanced FlexForm 35 | 36 | 37 | Examples: advanced FlexForm with localization type 1 38 | 39 | 40 | Examples: advanced FlexForm with localization type 2 41 | 42 | 43 | Examples: error handling 44 | 45 | 46 | Examples: HTML parsing 47 | 48 | 49 | General Setup 50 | 51 | 52 | Reference page 53 | 54 | 55 | Choose a page 56 | 57 | 58 | Message 59 | 60 | 61 | Header 62 | 63 | 64 | Message 65 | 66 | 67 | Dummy Table 68 | 69 | 70 | Title 71 | 72 | 73 | Type 74 | 75 | 76 | Normal 77 | 78 | 79 | Short 80 | 81 | 82 | Weird 83 | 84 | 85 | Some date 86 | 87 | 88 | Enforce date 89 | 90 | 91 | Description 92 | 93 | 94 | Haiku 95 | 96 | 97 | Title 98 | 99 | 100 | Text 101 | 102 | 103 | File 104 | 105 | 106 | Load content from file 107 | 108 | 109 | File status 110 | 111 | 112 | Season 113 | 114 | 115 | Spring 116 | 117 | 118 | Summer 119 | 120 | 121 | Autumn 122 | 123 | 124 | Winter 125 | 126 | 127 | Weirdness 128 | 129 | 130 | Color 131 | 132 | 133 | Pick a color 134 | 135 | 136 | Angle 137 | 138 | 139 | Images 140 | 141 | 142 | Images (all controls available) 143 | 144 | 145 | Images (no file browser) 146 | 147 | 148 | Images (no upload button) 149 | 150 | 151 | Images (no list display) 152 | 153 | 154 | Images (no delete button) 155 | 156 | 157 | Images (no controls at all) 158 | 159 | 160 | Images (FAL) 161 | 162 | 163 | Images (group-type) 164 | 165 | 166 | Images (inline-type) 167 | 168 | 169 | Reference page 170 | 171 | 172 | Related records 173 | 174 | 175 | Related content 176 | 177 | 178 | Contains "image" 179 | 180 | 181 | Contains "typo3" 182 | 183 | 184 | Relations 185 | 186 | 187 | 188 | -------------------------------------------------------------------------------- /Resources/Private/Layouts/Default.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Resources/Private/Layouts/Module.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 |
12 |
13 | 14 | 15 | 16 |
17 |
18 |
19 |
20 | -------------------------------------------------------------------------------- /Resources/Private/Partials/Module/Header.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 |
6 |
7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 |
 
17 |
18 |
19 |
 
20 |
21 | 22 |
23 |
24 |
25 |
26 | -------------------------------------------------------------------------------- /Resources/Private/Templates/Collection/Index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
    5 | 6 |
  • 7 | {collection.title} (Records from {collection.itemTableName}) 8 |
      9 | 10 |
    • {record.title}
    • 11 |
      12 |
    13 |
  • 14 |
    15 |
16 |
-------------------------------------------------------------------------------- /Resources/Private/Templates/Default/Clipboard.html: -------------------------------------------------------------------------------- 1 | {namespace Ex=Documentation\Examples\ViewHelpers} 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |

11 |
12 | 13 | 14 |

15 | 16 |

17 |

18 | 19 | 20 |
    21 | 22 |
  • {file}
  • 23 |
    24 |
25 |
26 | 27 |

28 |
29 |
30 |

31 | 32 | 33 |
    34 | 35 |
  • {page}
  • 36 |
    37 |
38 |
39 | 40 |

41 |
42 |
43 | 44 |

45 |

46 | 47 | 48 |
    49 | 50 |
  • {file}
  • 51 |
    52 |
53 |
54 | 55 |

56 |
57 |
58 |

59 | 60 | 61 |
    62 | 63 |
  • {page}
  • 64 |
    65 |
66 |
67 | 68 |

69 |
70 |
71 |
-------------------------------------------------------------------------------- /Resources/Private/Templates/Default/Flash.html: -------------------------------------------------------------------------------- 1 | {namespace Ex=Documentation\Examples\ViewHelpers} 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 |
-------------------------------------------------------------------------------- /Resources/Private/Templates/Default/Links.html: -------------------------------------------------------------------------------- 1 | {namespace Ex=Documentation\Examples\ViewHelpers} 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 |
-------------------------------------------------------------------------------- /Resources/Private/Templates/Default/Log.html: -------------------------------------------------------------------------------- 1 | {namespace Ex=Documentation\Examples\ViewHelpers} 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |

11 |
12 | 13 | 14 |

15 | 16 |

17 | 18 |

19 |
20 |
-------------------------------------------------------------------------------- /Resources/Private/Templates/Default/Tree.html: -------------------------------------------------------------------------------- 1 | {namespace Ex=Documentation\Examples\ViewHelpers} 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 |
Icon / Title:Page UID:
{page.HTML} {page.row.title}{page.row.uid}
28 |
-------------------------------------------------------------------------------- /Resources/Public/Images/Archive.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TYPO3-extensions/examples/5f87aa1d6648da6a7b56026d2d9f4d4740d5003d/Resources/Public/Images/Archive.png -------------------------------------------------------------------------------- /Resources/Public/Images/Dummy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TYPO3-extensions/examples/5f87aa1d6648da6a7b56026d2d9f4d4740d5003d/Resources/Public/Images/Dummy.png -------------------------------------------------------------------------------- /Resources/Public/Images/Haiku.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TYPO3-extensions/examples/5f87aa1d6648da6a7b56026d2d9f4d4740d5003d/Resources/Public/Images/Haiku.png -------------------------------------------------------------------------------- /Resources/Public/Images/JapaneseGarden.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TYPO3-extensions/examples/5f87aa1d6648da6a7b56026d2d9f4d4740d5003d/Resources/Public/Images/JapaneseGarden.jpg -------------------------------------------------------------------------------- /Resources/Public/Images/PageTree.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TYPO3-extensions/examples/5f87aa1d6648da6a7b56026d2d9f4d4740d5003d/Resources/Public/Images/PageTree.png -------------------------------------------------------------------------------- /Resources/Public/Images/PiErrorWizard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TYPO3-extensions/examples/5f87aa1d6648da6a7b56026d2d9f4d4740d5003d/Resources/Public/Images/PiErrorWizard.png -------------------------------------------------------------------------------- /Resources/Public/Images/moduleIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TYPO3-extensions/examples/5f87aa1d6648da6a7b56026d2d9f4d4740d5003d/Resources/Public/Images/moduleIcon.png -------------------------------------------------------------------------------- /Resources/Public/JavaScript/Application.js: -------------------------------------------------------------------------------- 1 | /** 2 | * ExtJS code for extension "examples" BE module 3 | */ 4 | Ext.namespace('TYPO3.Examples'); 5 | 6 | Ext.onReady(function() { 7 | Ext.addBehaviors({ 8 | // Add a listener for click on scheduler execute button 9 | '.action-button@click' : function(event, target) { 10 | var table = Ext.get(target).getAttribute('name'); 11 | // ExtDirect call 12 | TYPO3.Examples.ExtDirect.countRecords(table, function(response) { 13 | // If the response contains data, display it in a JavaScript flash message 14 | if (response.data) { 15 | var message = String.format(TYPO3.lang['record_count_message'], response.data, table); 16 | TYPO3.Flashmessage.display(TYPO3.Severity.ok, TYPO3.lang['record_count_title'], message, 5); 17 | } 18 | }); 19 | } 20 | }); 21 | }); -------------------------------------------------------------------------------- /components/navigation/javascript/Navigation.js: -------------------------------------------------------------------------------- 1 | Ext.ns('TYPO3.Navigation'); 2 | 3 | TYPO3.Navigation.Navigator = Ext.extend(Ext.Panel, { 4 | id: 'typo3-navigation', 5 | html: 'Hello World!' 6 | }); 7 | 8 | TYPO3.ModuleMenu.App.registerNavigationComponent('typo3-navigation', function() { 9 | return new TYPO3.Navigation.Navigator(); 10 | }); 11 | -------------------------------------------------------------------------------- /ext_emconf.php: -------------------------------------------------------------------------------- 1 | 'Core Documentation Code Examples', 13 | 'description' => 'This extension packages a number of code examples from the Core Documentation', 14 | 'category' => 'example', 15 | 'author' => 'Documentation Team', 16 | 'author_email' => 'documentation@typo3.org', 17 | 'shy' => '', 18 | 'dependencies' => '', 19 | 'conflicts' => '', 20 | 'priority' => '', 21 | 'module' => '', 22 | 'state' => 'alpha', 23 | 'internal' => '', 24 | 'uploadfolder' => 0, 25 | 'createDirs' => '', 26 | 'modify_tables' => '', 27 | 'clearCacheOnLoad' => 0, 28 | 'lockType' => '', 29 | 'author_company' => '', 30 | 'version' => '0.6.2', 31 | 'constraints' => 32 | array ( 33 | 'depends' => 34 | array ( 35 | 'typo3' => '6.2.3-6.2.99', 36 | ), 37 | 'conflicts' => 38 | array ( 39 | ), 40 | 'suggests' => 41 | array ( 42 | ), 43 | ), 44 | '_md5_values_when_last_written' => 'a:32:{s:9:"ChangeLog";s:4:"870e";s:25:"class.tx_examples_tca.php";s:4:"4dbb";s:16:"ext_autoload.php";s:4:"6d41";s:12:"ext_icon.gif";s:4:"18c7";s:17:"ext_localconf.php";s:4:"9b37";s:14:"ext_tables.php";s:4:"d616";s:14:"ext_tables.sql";s:4:"f5cc";s:26:"icon_tx_examples_dummy.gif";s:4:"f3b6";s:26:"icon_tx_examples_haiku.gif";s:4:"737d";s:13:"locallang.xml";s:4:"13b7";s:33:"locallang_csh_txexampleshaiku.xml";s:4:"7fb4";s:16:"locallang_db.xml";s:4:"06dd";s:10:"README.txt";s:4:"71e5";s:7:"tca.php";s:4:"dd59";s:40:"Classes/Controller/DefaultController.php";s:4:"acd0";s:28:"Classes/ExtDirect/Server.php";s:4:"50d0";s:30:"Classes/Utilities/Viewport.php";s:4:"7838";s:43:"Classes/ViewHelpers/Be/HeaderViewHelper.php";s:4:"b149";s:40:"Resources/Private/Language/locallang.xml";s:4:"8600";s:37:"Resources/Private/Layouts/Module.html";s:4:"6f69";s:46:"Resources/Private/Templates/Default/Flash.html";s:4:"f524";s:38:"Resources/Public/Images/moduleIcon.png";s:4:"671c";s:42:"Resources/Public/JavaScript/Application.js";s:4:"6d2d";s:46:"components/navigation/javascript/Navigation.js";s:4:"624c";s:14:"doc/manual.sxw";s:4:"d907";s:26:"flexforms/flexform_ds1.xml";s:4:"28af";s:26:"flexforms/flexform_ds2.xml";s:4:"e9af";s:26:"flexforms/flexform_ds3.xml";s:4:"1011";s:26:"flexforms/flexform_ds4.xml";s:4:"985c";s:30:"res/images/japanese_garden.jpg";s:4:"7e0a";s:16:"static/setup.txt";s:4:"7528";s:38:"xclasses/class.tx_examples_scdbnew.php";s:4:"cd22";}', 45 | 'suggests' => 46 | array ( 47 | ), 48 | 'comment' => 'Code cleanup (in particular, make use of new license header).', 49 | 'user' => 'docteam', 50 | ); 51 | 52 | ?> -------------------------------------------------------------------------------- /ext_icon.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TYPO3-extensions/examples/5f87aa1d6648da6a7b56026d2d9f4d4740d5003d/ext_icon.gif -------------------------------------------------------------------------------- /ext_localconf.php: -------------------------------------------------------------------------------- 1 | TYPO3 API overview > PHP Class Extension > Which classes? > Example - Adding a small feature in the interface 6 | $GLOBALS['TYPO3_CONF_VARS']['SYS']['Objects']['TYPO3\\CMS\\Backend\\Controller\\NewRecordController'] = array( 7 | 'className' => 'Documentation\\Examples\\Xclass\\NewRecordController' 8 | ); 9 | 10 | // Define custom permission options 11 | // USAGE: Core APIs > TYPO3 API overview > Various examples > Custom permission 12 | $GLOBALS['TYPO3_CONF_VARS']['BE']['customPermOptions'] = array( 13 | 'tx_examples_cat1' => array( 14 | 'header' => 'LLL:EXT:examples/Resources/Private/Language/locallang.xlf:permissions_header', 15 | 'items' => array( 16 | 'key1' => array( 17 | 'LLL:EXT:examples/Resources/Private/Language/locallang.xlf:permissions_option1', 18 | 'EXT:t3skin/icons/gfx/savedok.gif', 19 | 'LLL:EXT:examples/Resources/Private/Language/locallang.xlf:permissions_option1_description', 20 | ), 21 | 'key2' => array('LLL:EXT:examples/Resources/Private/Language/locallang.xlf:permissions_option2'), 22 | 'key3' => array('LLL:EXT:examples/Resources/Private/Language/locallang.xlf:permissions_option3'), 23 | ) 24 | ) 25 | ); 26 | 27 | $GLOBALS['TYPO3_CONF_VARS']['LOG']['Documentation']['Examples']['Controller']['writerConfiguration'][\TYPO3\CMS\Core\Log\LogLevel::DEBUG] = $GLOBALS['TYPO3_CONF_VARS']['LOG']['writerConfiguration'][\TYPO3\CMS\Core\Log\LogLevel::DEBUG]; 28 | // Add example configuration for the logging API 29 | $GLOBALS['TYPO3_CONF_VARS']['LOG']['Documentation']['Examples']['Controller']['writerConfiguration'][\TYPO3\CMS\Core\Log\LogLevel::WARNING] = array( 30 | // configuration for WARNING severity, including all 31 | // levels with higher severity (ERROR, CRITICAL, EMERGENCY) 32 | // add a SyslogWriter 33 | 'TYPO3\\CMS\\Core\\Log\\Writer\\SyslogWriter' => array(), 34 | ); 35 | $GLOBALS['TYPO3_CONF_VARS']['LOG']['Documentation']['Examples']['Controller']['processorConfiguration'] = array( 36 | // configuration for ERROR level log entries 37 | \TYPO3\CMS\Core\Log\LogLevel::ERROR => array( 38 | // add a MemoryUsageProcessor 39 | 'TYPO3\\CMS\\Core\\Log\\Processor\\MemoryUsageProcessor' => array( 40 | 'formatSize' => TRUE 41 | ) 42 | ) 43 | ); 44 | 45 | // Register ExtDirect method 46 | \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::registerExtDirectComponent( 47 | 'TYPO3.Examples.ExtDirect', 48 | \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($_EXTKEY, 'Classes/ExtDirect/Server.php:Tx_Examples_ExtDirect_Server') 49 | ); 50 | 51 | /* 52 | // Register a class for manipulating the page rendering process 53 | // (used in TYPO3 Viewport manipulation demonstration) 54 | // NOTE: even though the code itself works, it breaks the TYPO3 backend 55 | // This code should be revisited at some point, but this requires solid ExtJS knowledge 56 | $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_pagerenderer.php']['render-preProcess'][] = 57 | 'EXT:' . $_EXTKEY . '/Classes/Utilities/Viewport.php:Tx_Examples_Utilities_Viewport->renderPreProcess'; 58 | */ 59 | 60 | \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPItoST43( 61 | $_EXTKEY, 62 | 'pierror/class.tx_examples_pierror.php', 63 | '_pierror', 64 | 'list_type', 65 | 1 66 | ); 67 | \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPItoST43( 68 | $_EXTKEY, 69 | 'pihtml/class.tx_examples_pihtml.php', 70 | '_pihtml', 71 | 'list_type', 72 | 1 73 | ); 74 | 75 | // Register the collections plugin 76 | \TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin( 77 | 'Documentation.' . $_EXTKEY, 78 | 'Collections', 79 | array( 80 | 'Collection' => 'index', 81 | ) 82 | ); 83 | 84 | // Add custom translations overriding default labels 85 | $GLOBALS['TYPO3_CONF_VARS']['SYS']['locallangXMLOverride']['EXT:cms/locallang_tca.xlf'][] = 'EXT:examples/Resources/Private/Language/custom.xlf'; 86 | $GLOBALS['TYPO3_CONF_VARS']['SYS']['locallangXMLOverride']['de']['EXT:cms/locallang_tca.xlf'][] = 'EXT:examples/Resources/Private/Language/de.custom.xlf'; 87 | 88 | // Register custom RTE transformation 89 | $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_parsehtml_proc.php']['transformation']['tx_examples_transformation'] = 'Documentation\Examples\Service\RteTransformation'; 90 | 91 | // Add necessary TSconfig to active custom RTE transformation 92 | \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPageTSConfig( 93 | 'RTE.default.proc.usertrans.tx_examples_transformation.addHrulerInRTE = 1 94 | RTE.config.tx_examples_haiku.poem.proc.overruleMode = tx_examples_transformation,ts_css' 95 | ); 96 | -------------------------------------------------------------------------------- /ext_tables.php: -------------------------------------------------------------------------------- 1 | 'flash,log,tree,clipboard,links' 28 | ), 29 | array( 30 | 'access' => 'user,group', 31 | 'icon' => 'EXT:' . $_EXTKEY . '/Resources/Public/Images/moduleIcon.png', 32 | 'labels' => 'LLL:EXT:' . $_EXTKEY . '/Resources/Private/Language/locallang.xml', 33 | 'navigationComponentId' => 'typo3-navigation' 34 | ) 35 | ); 36 | // Register the navigation component 37 | \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addNavigationComponent( 38 | 'tools_Examples', 39 | 'typo3-navigation' 40 | ); 41 | } 42 | 43 | if (TYPO3_MODE == 'BE') { 44 | $GLOBALS['TBE_MODULES_EXT']['xMOD_alt_clickmenu']['extendCMclasses'][] = array( 45 | 'name' => 'Documentation\\Examples\\Service\\ContextMenuOptions' 46 | ); 47 | $icons = array( 48 | 'page-tree' => $relativeExtensionPath . 'Resources/Public/Images/PageTree.png' 49 | ); 50 | \TYPO3\CMS\Backend\Sprite\SpriteManager::addSingleIcons($icons, $_EXTKEY); 51 | } 52 | 53 | // Add extra fields to User Settings and be_user TCA fields 54 | 55 | $tempColumnsBackend = array( 56 | 'tx_examples_mobile' => array( 57 | 'label' => 'LLL:EXT:examples/Resources/Private/Language/locallang_db.xlf:be_users.tx_examples_mobile', 58 | 'config' => array( 59 | 'type' => 'input', 60 | 'size' => 30 61 | ) 62 | ) 63 | ); 64 | 65 | \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns('be_users', $tempColumnsBackend, TRUE); 66 | \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes('be_users', 'tx_examples_mobile', '', 'after:email'); 67 | 68 | $GLOBALS['TYPO3_USER_SETTINGS']['columns']['tx_examples_mobile'] = array( 69 | 'label' => 'LLL:EXT:examples/Resources/Private/Language/locallang_db.xlf:be_users.tx_examples_mobile', 70 | 'type' => 'text', 71 | 'table' => 'be_users', 72 | ); 73 | \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addFieldsToUserSettings('LLL:EXT:examples/Resources/Private/Language/locallang_db.xlf:be_users.tx_examples_mobile,tx_examples_mobile', 'after:email'); 74 | 75 | // Create various FE plugins to demonstrate FlexForms definition 76 | // USAGE: TCA Reference > $TCA array reference > ['columns'][fieldname]['config'] / TYPE: "flex" 77 | 78 | // Disable the display of layout and select_key fields for the plugins 79 | // provided by the extension 80 | $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_excludelist'][$_EXTKEY . '_pi1'] = 'layout,select_key,pages'; 81 | $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_excludelist'][$_EXTKEY . '_pi2'] = 'layout,select_key,pages'; 82 | $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_excludelist'][$_EXTKEY . '_pi3'] = 'layout,select_key,pages'; 83 | $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_excludelist'][$_EXTKEY . '_pi4'] = 'layout,select_key,pages'; 84 | $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_excludelist'][$_EXTKEY . '_pierror'] = 'layout,select_key,pages'; 85 | $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_excludelist'][$_EXTKEY . '_pihtml'] = 'layout,select_key,pages'; 86 | 87 | // Activate the display of the plug-in flexform field and set FlexForm definition 88 | $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist'][$_EXTKEY . '_pi1'] = 'pi_flexform'; 89 | \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue( 90 | $_EXTKEY . '_pi1', 'FILE:EXT:examples/Configuration/Flexforms/flexform_ds1.xml' 91 | ); 92 | $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist'][$_EXTKEY . '_pi2'] = 'pi_flexform'; 93 | \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue( 94 | $_EXTKEY . '_pi2', 'FILE:EXT:examples/Configuration/Flexforms/flexform_ds2.xml' 95 | ); 96 | $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist'][$_EXTKEY . '_pi3'] = 'pi_flexform'; 97 | \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue( 98 | $_EXTKEY . '_pi3', 'FILE:EXT:examples/Configuration/Flexforms/flexform_ds3.xml' 99 | ); 100 | $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist'][$_EXTKEY . '_pi4'] = 'pi_flexform'; 101 | \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue( 102 | $_EXTKEY . '_pi4', 'FILE:EXT:examples/Configuration/Flexforms/flexform_ds4.xml' 103 | ); 104 | 105 | // Add the plugins to the list of plugins 106 | \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPlugin( 107 | array( 108 | 'LLL:EXT:examples/Resources/Private/Language/locallang_db.xlf:tt_content.list_type_pi1', 109 | $_EXTKEY . '_pi1' 110 | ), 111 | 'list_type' 112 | ); 113 | \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPlugin( 114 | array( 115 | 'LLL:EXT:examples/Resources/Private/Language/locallang_db.xlf:tt_content.list_type_pi2', 116 | $_EXTKEY . '_pi2' 117 | ), 118 | 'list_type' 119 | ); 120 | \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPlugin( 121 | array( 122 | 'LLL:EXT:examples/Resources/Private/Language/locallang_db.xlf:tt_content.list_type_pi3', 123 | $_EXTKEY . '_pi3' 124 | ), 125 | 'list_type' 126 | ); 127 | \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPlugin( 128 | array( 129 | 'LLL:EXT:examples/Resources/Private/Language/locallang_db.xlf:tt_content.list_type_pi4', 130 | $_EXTKEY . '_pi4' 131 | ), 132 | 'list_type' 133 | ); 134 | \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPlugin( 135 | array( 136 | 'LLL:EXT:examples/Resources/Private/Language/locallang_db.xlf:tt_content.list_type_pierror', 137 | $_EXTKEY . '_pierror' 138 | ), 139 | 'list_type' 140 | ); 141 | \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPlugin( 142 | array( 143 | 'LLL:EXT:examples/Resources/Private/Language/locallang_db.xlf:tt_content.list_type_pihtml', 144 | $_EXTKEY . '_pihtml' 145 | ), 146 | 'list_type' 147 | ); 148 | // Register the collections plugin 149 | \TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin( 150 | $_EXTKEY, 151 | 'Collections', 152 | 'LLL:EXT:' . $_EXTKEY . '/Resources/Private/Language/locallang.xlf:collections_plugin_title' 153 | ); 154 | 155 | // Add "pierror" plugin to new element wizard 156 | if (TYPO3_MODE == 'BE') { 157 | $TBE_MODULES_EXT['xMOD_db_new_content_el']['addElClasses']['tx_examples_pierror_wizicon'] = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($_EXTKEY) . 'pierror/class.tx_examples_pierror_wizicon.php'; 158 | } 159 | 160 | 161 | // New tables for demonstrating various TCA features 162 | 163 | // Add table icons to sprite 164 | \TYPO3\CMS\Backend\Sprite\SpriteManager::addSingleIcons( 165 | array( 166 | 'dummy-default' => $relativeExtensionPath . 'Resources/Public/Images/Dummy.png', 167 | 'haiku-default' => $relativeExtensionPath . 'Resources/Public/Images/Haiku.png' 168 | ), 169 | $_EXTKEY 170 | ); 171 | 172 | // Allow dummy table anywhere in the page tree 173 | \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::allowTableOnStandardPages('tx_examples_dummy'); 174 | 175 | // Allow the haiku table anywhere in the page tree 176 | \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::allowTableOnStandardPages('tx_examples_haiku'); 177 | 178 | // Add context sensitive help (csh) for the haiku table 179 | \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addLLrefForTCAdescr( 180 | 'tx_examples_haiku', 181 | $fullExtensionPath . 'Resources/Private/Language/locallang_csh_txexampleshaiku.xml' 182 | ); 183 | 184 | 185 | // Define a new doktype 186 | $customPageDoktype = 116; 187 | $customPageIcon = $relativeExtensionPath . 'Resources/Public/Images/Archive.png'; 188 | // Add the new doktype to the list of page types 189 | $GLOBALS['PAGES_TYPES'][$customPageDoktype] = array( 190 | 'type' => 'sys', 191 | 'icon' => $customPageIcon, 192 | 'allowedTables' => '*' 193 | ); 194 | // Add the new doktype to the page type selector 195 | $GLOBALS['TCA']['pages']['columns']['doktype']['config']['items'][] = array( 196 | 'LLL:EXT:examples/Resources/Private/Language/locallang.xlf:archive_page_type', 197 | $customPageDoktype, 198 | $customPageIcon 199 | ); 200 | // Also add the new doktype to the page language overlays type selector (so that translations can inherit the same type) 201 | $GLOBALS['TCA']['pages_language_overlay']['columns']['doktype']['config']['items'][] = array( 202 | 'LLL:EXT:examples/Resources/Private/Language/locallang.xlf:archive_page_type', 203 | $customPageDoktype, 204 | $customPageIcon 205 | ); 206 | // Add the icon for the new doktype 207 | \TYPO3\CMS\Backend\Sprite\SpriteManager::addTcaTypeIcon('pages', $customPageDoktype, $customPageIcon); 208 | // Add the new doktype to the list of types available from the new page menu at the top of the page tree 209 | \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addUserTSConfig( 210 | 'options.pageTree.doktypesToShowInNewPageDragArea := addToList(' . $customPageDoktype . ')' 211 | ); 212 | -------------------------------------------------------------------------------- /ext_tables.sql: -------------------------------------------------------------------------------- 1 | # 2 | # Table structure for table 'fe_users' 3 | # 4 | CREATE TABLE fe_users ( 5 | tx_examples_options int(11) DEFAULT '0' NOT NULL, 6 | tx_examples_special varchar(255) DEFAULT '' NOT NULL 7 | ); 8 | 9 | # 10 | # Table structure for table 'be_users' 11 | # 12 | CREATE TABLE be_users ( 13 | tx_examples_mobile varchar(60) DEFAULT '' NOT NULL 14 | ); 15 | 16 | # 17 | # Table structure for table 'tt_content' 18 | # 19 | CREATE TABLE tt_content ( 20 | tx_examples_noprint tinyint(4) DEFAULT '0' NOT NULL 21 | ); 22 | 23 | # 24 | # Table structure for example table 'dummy' 25 | # 26 | CREATE TABLE tx_examples_dummy ( 27 | uid int(11) NOT NULL auto_increment, 28 | pid int(11) DEFAULT '0' NOT NULL, 29 | tstamp int(11) DEFAULT '0' NOT NULL, 30 | crdate int(11) DEFAULT '0' NOT NULL, 31 | cruser_id int(11) DEFAULT '0' NOT NULL, 32 | deleted tinyint(4) DEFAULT '0' NOT NULL, 33 | hidden tinyint(4) DEFAULT '0' NOT NULL, 34 | record_type tinyint(4) DEFAULT '0' NOT NULL, 35 | title varchar(100) DEFAULT '' NOT NULL, 36 | some_date int(11) DEFAULT '0' NOT NULL, 37 | enforce_date tinyint(4) DEFAULT '0' NOT NULL, 38 | description text, 39 | 40 | PRIMARY KEY (uid), 41 | ); 42 | 43 | # 44 | # Table structure for example table 'haiku' 45 | # 46 | CREATE TABLE tx_examples_haiku ( 47 | uid int(11) NOT NULL auto_increment, 48 | pid int(11) DEFAULT '0' NOT NULL, 49 | tstamp int(11) DEFAULT '0' NOT NULL, 50 | crdate int(11) DEFAULT '0' NOT NULL, 51 | cruser_id int(11) DEFAULT '0' NOT NULL, 52 | deleted tinyint(4) DEFAULT '0' NOT NULL, 53 | hidden tinyint(4) DEFAULT '0' NOT NULL, 54 | title varchar(100) DEFAULT '' NOT NULL, 55 | poem text, 56 | filename varchar(255) DEFAULT '' NOT NULL, 57 | filesource tinyint(4) DEFAULT '0' NOT NULL, 58 | filestatus varchar(255) DEFAULT '' NOT NULL, 59 | season varchar(100) DEFAULT '' NOT NULL, 60 | weirdness varchar(100) DEFAULT '0' NOT NULL, 61 | color varchar(20) DEFAULT '' NOT NULL, 62 | angle int(11) DEFAULT '0' NOT NULL, 63 | image1 text, 64 | image2 text, 65 | image3 text, 66 | image4 text, 67 | image5 text, 68 | image6 text, 69 | image_fal_group text, 70 | image_fal_irre text, 71 | reference_page int(11) DEFAULT '0' NOT NULL, 72 | related_records text, 73 | related_content text, 74 | 75 | PRIMARY KEY (uid), 76 | ); 77 | -------------------------------------------------------------------------------- /pierror/class.tx_examples_pierror.php: -------------------------------------------------------------------------------- 1 | 19 | * @package TYPO3 20 | * @subpackage tx_examples 21 | */ 22 | class tx_examples_pierror extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin { 23 | 24 | /** 25 | * Same as class name 26 | * 27 | * @var string 28 | */ 29 | public $prefixId = 'tx_examples_pierror'; 30 | 31 | /** 32 | * Path to this script relative to the extension dir. 33 | * 34 | * @var string 35 | */ 36 | public $scriptRelPath = 'pierror/class.tx_examples_pierror.php'; 37 | 38 | /** 39 | * The extension key. 40 | * 41 | * @var string 42 | */ 43 | public $extKey = 'examples'; 44 | 45 | /** 46 | * @var bool 47 | */ 48 | public $pi_checkCHash = TRUE; 49 | 50 | /** 51 | * This is the main method of the plugin. It returns the content to display 52 | * 53 | * @param string $content The plugin content 54 | * @param array $conf The plugin configuration 55 | * @throws Exception 56 | * @return string The content that is displayed on the website 57 | */ 58 | public function main($content, $conf) { 59 | throw new \Exception('This is a test Exception', 1360332631); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /pierror/class.tx_examples_pierror_wizicon.php: -------------------------------------------------------------------------------- 1 | 19 | * @package TYPO3 20 | * @subpackage tx_examples 21 | */ 22 | class tx_examples_pierror_wizicon { 23 | 24 | /** 25 | * Processing the wizard items array 26 | * 27 | * @param array $wizardItems The wizard items 28 | * @return array Modified array with wizard items 29 | */ 30 | public function proc($wizardItems) { 31 | $wizardItems['plugins_tx_examples_pierror'] = array( 32 | 'icon' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('examples') . 'Resources/Public/Images/PiErrorWizard.png', 33 | 'title' => $GLOBALS['LANG']->sL('LLL:EXT:examples/Resources/Private/Language/locallang.xlf:pierror_wizard_title'), 34 | 'description' => $GLOBALS['LANG']->sL('LLL:EXT:examples/Resources/Private/Language/locallang.xlf:pierror_wizard_description'), 35 | 'params' => '&defVals[tt_content][CType]=list&defVals[tt_content][list_type]=examples_pierror' 36 | ); 37 | 38 | return $wizardItems; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /pihtml/class.tx_examples_pihtml.php: -------------------------------------------------------------------------------- 1 | 19 | * @package TYPO3 20 | * @subpackage tx_examples 21 | */ 22 | class tx_examples_pihtml extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin { 23 | 24 | /** 25 | * Same as class name 26 | * 27 | * @var string 28 | */ 29 | public $prefixId = 'tx_examples_pihtml'; 30 | 31 | /** 32 | * Path to this script relative to the extension dir. 33 | * 34 | * @var string 35 | */ 36 | public $scriptRelPath = 'pierror/class.tx_examples_pihtml.php'; 37 | 38 | /** 39 | * The extension key. 40 | * 41 | * @var string 42 | */ 43 | public $extKey = 'examples'; 44 | 45 | /** 46 | * @var bool 47 | */ 48 | public $pi_checkCHash = TRUE; 49 | 50 | /** 51 | * This is the main method of the plugin. It returns the content to display 52 | * 53 | * @param string $content The plugin content 54 | * @param array $conf The plugin configuration 55 | * @throws Exception 56 | * @return string The content that is displayed on the website 57 | */ 58 | public function main($content, $conf) { 59 | $testHTML = ' 60 |
61 | 62 |

Line 1

63 |

Line 2

64 |

Line 3

65 | 66 |

67 | 68 | 69 | 70 | 71 |
Another line here
72 |
73 | Text outside div tag 74 | 75 | 76 | 77 | 78 |
Another line here
79 | '; 80 | 81 | // Splitting HTML into blocks defined by
and block tags 82 | $parseObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Html\\HtmlParser'); 83 | $result = $parseObj->splitIntoBlock('div,table', $testHTML); 84 | 85 | $content = '

Splitting by <div> and <table> tags

'; 86 | $content .= \TYPO3\CMS\Core\Utility\DebugUtility::viewArray($result); 87 | 88 | // Splitting HTML into blocks defined by and
single tags 89 | $result = $parseObj->splitTags('img,br', $testHTML); 90 | $content .= '

Extracting <img> and <br> tags

'; 91 | $content .= \TYPO3\CMS\Core\Utility\DebugUtility::viewArray($result); 92 | 93 | // Cleaning HTML 94 | $tagCfg = array( 95 | 'b' => array( 96 | 'nesting' => 1, 97 | 'remap' => 'strong', 98 | 'allowedAttribs' => 0 99 | ), 100 | 'img' => array(), 101 | 'div' => array(), 102 | 'br' => array(), 103 | 'p' => array( 104 | 'fixAttrib' => array( 105 | 'class' => array( 106 | 'set' => 'bodytext' 107 | ) 108 | ) 109 | ) 110 | ); 111 | $result = $parseObj->HTMLcleaner( 112 | $testHTML, 113 | $tagCfg, 114 | FALSE, 115 | FALSE, 116 | array('xhtml' => 1) 117 | ); 118 | $content .= '

Cleaning to XHTML, removing non-allowed tags and attributes

'; 119 | $content .= \TYPO3\CMS\Core\Utility\DebugUtility::viewArray($result); 120 | 121 | return $content; 122 | } 123 | } 124 | --------------------------------------------------------------------------------