"Fossies" - the Fresh Open Source Software Archive

Member "phpMyAdmin-5.1.0-all-languages/libraries/classes/Twig/RelationExtension.php" (24 Feb 2021, 1482 Bytes) of package /linux/www/phpMyAdmin-5.1.0-all-languages.zip:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) PHP source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. See also the last Fossies "Diffs" side-by-side code changes report for "RelationExtension.php": 5.0.4-english_vs_5.1.0-english.

    1 <?php
    2 
    3 declare(strict_types=1);
    4 
    5 namespace PhpMyAdmin\Twig;
    6 
    7 use PhpMyAdmin\Relation;
    8 use Twig\Extension\AbstractExtension;
    9 use Twig\TwigFunction;
   10 
   11 class RelationExtension extends AbstractExtension
   12 {
   13     /**
   14      * Returns a list of functions to add to the existing list.
   15      *
   16      * @return TwigFunction[]
   17      */
   18     public function getFunctions()
   19     {
   20         global $dbi;
   21 
   22         $relation = new Relation($dbi);
   23 
   24         return [
   25             new TwigFunction(
   26                 'foreign_dropdown',
   27                 [
   28                     $relation,
   29                     'foreignDropdown',
   30                 ],
   31                 ['is_safe' => ['html']]
   32             ),
   33             new TwigFunction(
   34                 'get_display_field',
   35                 [
   36                     $relation,
   37                     'getDisplayField',
   38                 ],
   39                 ['is_safe' => ['html']]
   40             ),
   41             new TwigFunction(
   42                 'get_foreign_data',
   43                 [
   44                     $relation,
   45                     'getForeignData',
   46                 ]
   47             ),
   48             new TwigFunction(
   49                 'get_tables',
   50                 [
   51                     $relation,
   52                     'getTables',
   53                 ]
   54             ),
   55             new TwigFunction(
   56                 'search_column_in_foreigners',
   57                 [
   58                     $relation,
   59                     'searchColumnInForeigners',
   60                 ]
   61             ),
   62         ];
   63     }
   64 }