[TASK] Streamline phpdoc annotations in EXT:fluid
[Packages/TYPO3.CMS.git] / typo3 / sysext / fluid / Classes / ViewHelpers / Widget / AutocompleteViewHelper.php
1 <?php
2 namespace TYPO3\CMS\Fluid\ViewHelpers\Widget;
3
4 /*
5 * This file is part of the TYPO3 CMS project.
6 *
7 * It is free software; you can redistribute it and/or modify it under
8 * the terms of the GNU General Public License, either version 2
9 * of the License, or any later version.
10 *
11 * For the full copyright and license information, please read the
12 * LICENSE.txt file that was distributed with this source code.
13 *
14 * The TYPO3 project - inspiring people to share!
15 */
16 use TYPO3\CMS\Extbase\Persistence\QueryResultInterface;
17
18 /**
19 * Simple paginate widget
20 * Note: Make sure to include jQuery and jQuery UI in the HTML, like that:
21 * <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
22 * <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.4/jquery-ui.min.js"></script>
23 * <link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.3/themes/base/jquery-ui.css" type="text/css" media="all" />
24 * <link rel="stylesheet" href="http://static.jquery.com/ui/css/demo-docs-theme/ui.theme.css" type="text/css" media="all" />
25 * You can include the provided TS template that includes the above snippet to the pages headerData.
26 *
27 * = Examples =
28 *
29 * <code title="Render lib object">
30 * <input type="text" id="name" />
31 * <f:widget.autocomplete for="name" objects="{posts}" searchProperty="author">
32 * </code>
33 * <output>
34 * <input type="text" id="name" />
35 * the input field and the required JavaScript for the Ajax communication (see Resources/Private/Templates/ViewHelpers/Widget/Autocomplete/Index.html
36 * </output>
37 */
38 class AutocompleteViewHelper extends \TYPO3\CMS\Fluid\Core\Widget\AbstractWidgetViewHelper
39 {
40 /**
41 * @var bool
42 */
43 protected $ajaxWidget = true;
44
45 /**
46 * @var \TYPO3\CMS\Fluid\ViewHelpers\Widget\Controller\AutocompleteController
47 */
48 protected $controller;
49
50 /**
51 * Initialize arguments
52 */
53 public function initializeArguments()
54 {
55 parent::initializeArguments();
56 $this->registerArgument('objects', QueryResultInterface::class, 'Objects to auto-complete', true);
57 $this->registerArgument('for', 'string', 'Property to fill', true);
58 $this->registerArgument('searchProperty', 'string', 'Property to search within when filtering list', true);
59 }
60
61 /**
62 * @param \TYPO3\CMS\Fluid\ViewHelpers\Widget\Controller\AutocompleteController $controller
63 */
64 public function injectAutocompleteController(\TYPO3\CMS\Fluid\ViewHelpers\Widget\Controller\AutocompleteController $controller)
65 {
66 $this->controller = $controller;
67 }
68
69 /**
70 * @return string
71 */
72 public function render()
73 {
74 return $this->initiateSubRequest();
75 }
76 }