WidgetInterface.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. /**
  3. * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
  4. * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
  5. *
  6. * Licensed under The MIT License
  7. * For full copyright and license information, please see the LICENSE.txt
  8. * Redistributions of files must retain the above copyright notice.
  9. *
  10. * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
  11. * @link http://cakephp.org CakePHP(tm) Project
  12. * @since 3.0.0
  13. * @license http://www.opensource.org/licenses/mit-license.php MIT License
  14. */
  15. namespace Cake\View\Widget;
  16. use Cake\View\Form\ContextInterface;
  17. /**
  18. * Interface for input widgets.
  19. */
  20. interface WidgetInterface {
  21. /**
  22. * Converts the $data into one or many HTML elements.
  23. *
  24. * @param array $data The data to render.
  25. * @param \Cake\View\Form\ContextInterface $context The current form context.
  26. * @return string Generated HTML for the widget element.
  27. */
  28. public function render(array $data, ContextInterface $context);
  29. /**
  30. * Returns a list of fields that need to be secured for
  31. * this widget. Fields are in the form of Model[field][suffix]
  32. *
  33. * @param array $data The data to render.
  34. * @return array Array of fields to secure.
  35. */
  36. public function secureFields(array $data);
  37. }