RelationExtension.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. /* vim: set expandtab sw=4 ts=4 sts=4: */
  3. /**
  4. * hold PhpMyAdmin\Twig\RelationExtension class
  5. *
  6. * @package PhpMyAdmin\Twig
  7. */
  8. namespace PhpMyAdmin\Twig;
  9. use PhpMyAdmin\Relation;
  10. use Twig\Extension\AbstractExtension;
  11. use Twig\TwigFunction;
  12. /**
  13. * Class RelationExtension
  14. *
  15. * @package PhpMyAdmin\Twig
  16. */
  17. class RelationExtension extends AbstractExtension
  18. {
  19. /**
  20. * Returns a list of functions to add to the existing list.
  21. *
  22. * @return TwigFunction[]
  23. */
  24. public function getFunctions()
  25. {
  26. $relation = new Relation();
  27. return array(
  28. new TwigFunction(
  29. 'Relation_foreignDropdown',
  30. [$relation, 'foreignDropdown'],
  31. array('is_safe' => array('html'))
  32. ),
  33. new TwigFunction(
  34. 'Relation_getDisplayField',
  35. [$relation, 'getDisplayField'],
  36. array('is_safe' => array('html'))
  37. ),
  38. new TwigFunction(
  39. 'Relation_getForeignData',
  40. [$relation, 'getForeignData']
  41. ),
  42. new TwigFunction(
  43. 'Relation_getTables',
  44. [$relation, 'getTables']
  45. ),
  46. new TwigFunction(
  47. 'Relation_searchColumnInForeigners',
  48. [$relation, 'searchColumnInForeigners']
  49. ),
  50. );
  51. }
  52. }