Verzeichnisstruktur phpBB-3.3.16


Veröffentlicht
27.04.2026

So funktioniert es


Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück

Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis.
Auf den Verzeichnisnamen klicken, dies zeigt nur das Verzeichnis mit Inhalt an

      (Beispiel Datei-Icons)

Auf das Icon klicken um den Quellcode anzuzeigen

SearchAndRenderBlockNode.php

Zuletzt modifiziert: 01.05.2026, 11:27 - Dateigröße: 4.48 KiB


 001  <?php
 002   
 003  /*
 004   * This file is part of the Symfony package.
 005   *
 006   * (c) Fabien Potencier <fabien@symfony.com>
 007   *
 008   * For the full copyright and license information, please view the LICENSE
 009   * file that was distributed with this source code.
 010   */
 011   
 012  namespace Symfony\Bridge\Twig\Node;
 013   
 014  use Twig\Compiler;
 015  use Twig\Node\Expression\ArrayExpression;
 016  use Twig\Node\Expression\ConstantExpression;
 017  use Twig\Node\Expression\FunctionExpression;
 018   
 019  /**
 020   * @author Bernhard Schussek <bschussek@gmail.com>
 021   */
 022  class SearchAndRenderBlockNode extends FunctionExpression
 023  {
 024      public function compile(Compiler $compiler)
 025      {
 026          $compiler->addDebugInfo($this);
 027          $compiler->raw('$this->env->getRuntime(\'Symfony\Component\Form\FormRenderer\')->searchAndRenderBlock(');
 028   
 029          preg_match('/_([^_]+)$/', $this->getAttribute('name'), $matches);
 030   
 031          $arguments = iterator_to_array($this->getNode('arguments'));
 032          $blockNameSuffix = $matches[1];
 033   
 034          if (isset($arguments[0])) {
 035              $compiler->subcompile($arguments[0]);
 036              $compiler->raw(', \''.$blockNameSuffix.'\'');
 037   
 038              if (isset($arguments[1])) {
 039                  if ('label' === $blockNameSuffix) {
 040                      // The "label" function expects the label in the second and
 041                      // the variables in the third argument
 042                      $label = $arguments[1];
 043                      $variables = isset($arguments[2]) ? $arguments[2] : null;
 044                      $lineno = $label->getTemplateLine();
 045   
 046                      if ($label instanceof ConstantExpression) {
 047                          // If the label argument is given as a constant, we can either
 048                          // strip it away if it is empty, or integrate it into the array
 049                          // of variables at compile time.
 050                          $labelIsExpression = false;
 051   
 052                          // Only insert the label into the array if it is not empty
 053                          if (!twig_test_empty($label->getAttribute('value'))) {
 054                              $originalVariables = $variables;
 055                              $variables = new ArrayExpression([], $lineno);
 056                              $labelKey = new ConstantExpression('label', $lineno);
 057   
 058                              if (null !== $originalVariables) {
 059                                  foreach ($originalVariables->getKeyValuePairs() as $pair) {
 060                                      // Don't copy the original label attribute over if it exists
 061                                      if ((string) $labelKey !== (string) $pair['key']) {
 062                                          $variables->addElement($pair['value'], $pair['key']);
 063                                      }
 064                                  }
 065                              }
 066   
 067                              // Insert the label argument into the array
 068                              $variables->addElement($label, $labelKey);
 069                          }
 070                      } else {
 071                          // The label argument is not a constant, but some kind of
 072                          // expression. This expression needs to be evaluated at runtime.
 073                          // Depending on the result (whether it is null or not), the
 074                          // label in the arguments should take precedence over the label
 075                          // in the attributes or not.
 076                          $labelIsExpression = true;
 077                      }
 078                  } else {
 079                      // All other functions than "label" expect the variables
 080                      // in the second argument
 081                      $label = null;
 082                      $variables = $arguments[1];
 083                      $labelIsExpression = false;
 084                  }
 085   
 086                  if (null !== $variables || $labelIsExpression) {
 087                      $compiler->raw(', ');
 088   
 089                      if (null !== $variables) {
 090                          $compiler->subcompile($variables);
 091                      }
 092   
 093                      if ($labelIsExpression) {
 094                          if (null !== $variables) {
 095                              $compiler->raw(' + ');
 096                          }
 097   
 098                          // Check at runtime whether the label is empty.
 099                          // If not, add it to the array at runtime.
 100                          $compiler->raw('(twig_test_empty($_label_ = ');
 101                          $compiler->subcompile($label);
 102                          $compiler->raw(') ? [] : ["label" => $_label_])');
 103                      }
 104                  }
 105              }
 106          }
 107   
 108          $compiler->raw(')');
 109      }
 110  }
 111