TestView.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. declare(strict_types=1);
  3. namespace TestApp\View;
  4. class TestView extends AppView
  5. {
  6. public function initialize(): void
  7. {
  8. $this->addHelper('Html', ['mykey' => 'myval']);
  9. }
  10. /**
  11. * getTemplateFileName method
  12. *
  13. * @param string|null $name Controller action to find template filename for
  14. * @return string Template filename
  15. */
  16. public function getTemplateFileName(?string $name = null): string
  17. {
  18. return $this->_getTemplateFileName($name);
  19. }
  20. /**
  21. * getLayoutFileName method
  22. *
  23. * @param string|null $name The name of the layout to find.
  24. * @return string Filename for layout file (.php).
  25. */
  26. public function getLayoutFileName(?string $name = null): string
  27. {
  28. return $this->_getLayoutFileName($name);
  29. }
  30. /**
  31. * paths method
  32. *
  33. * @param string|null $plugin Optional plugin name to scan for view files.
  34. * @param bool $cached Set to true to force a refresh of view paths.
  35. * @return string[] paths
  36. */
  37. public function paths(?string $plugin = null, bool $cached = true): array
  38. {
  39. return $this->_paths($plugin, $cached);
  40. }
  41. /**
  42. * Setter for extension.
  43. *
  44. * @param string $ext The extension
  45. */
  46. public function ext(string $ext): void
  47. {
  48. $this->_ext = $ext;
  49. }
  50. }