Feature #35766

add custom namespaces in settings.yaml

Added by rottenrice no-lastname-given over 3 years ago. Updated over 1 year ago.

Status:Rejected Start date:2012-04-07
Priority:Should have Due date:
Assigned To:- % Done:

0%

Category:View
Target version:-
Has patch:No

Description

the repeated declaration of your own namespaces in the template files is an unnecessary overhead. with this update you can define custom namespaces in your Settings.yaml.

enhanced/edited TYPO3\Fluid\Core\Parser\TemplateParser:

/**
 * Namespace identifiers and their component name prefix (Associative array).
 * @var array
 */
protected $namespaces = array();

/**
 * The FLOW3 settings
 * @var array
 */
protected $settings;

/**
 * Injects the settings and resets the namespace array
 *
 * @param array $settings The settings
 * @return void
 */
public function injectSettings(array $settings) {
    $this->settings = $settings;
    $this->reset();
}

/**
 * Resets the parser to its default values.
 *
 * @return void
 */
protected function reset() {
    $this->namespaces = array();
    if (isset($this->settings['Core']['Parser']['TemplateParser']['namespaces'])) {
        $this->namespaces = $this->settings['Core']['Parser']['TemplateParser']['namespaces'];
    }
}

added Settings.yaml in Packages/Framework/TYPO3.Fluid/Configuration (required):

TYPO3:
  Fluid:
    Core:
      Parser:
        TemplateParser:
          namespaces:
            f: 'TYPO3\Fluid\ViewHelpers'

now each package has the possibility to add custom namespaces in Packages/Application/*.*/Configuration/Settings.yaml (optional)

TYPO3:
  Fluid:
    Core:
      Parser:
        TemplateParser:
          namespaces:
            foo: 'my\foo\namespace'


Related issues

related to TYPO3.Fluid - Major Feature #2228: Default namespaces Rejected 2008-11-27
duplicates TYPO3.Fluid - Feature #4472: View helper namespaces should be configurable Closed 2009-09-07
duplicated by TYPO3.Fluid - Feature #58557: Define Namespaces in Configuration File Rejected 2014-05-06

History

#1 Updated by Sebastian Kurfuerst over 3 years ago

  • Status changed from New to Rejected

Hey there,

thanks for your ideas. Unfortunately, this is a feature we deliberately do not want as it makes Fluid Template files less interchangeable and less universally-readable. It is, in a nutshell, the same reason that XML files always need the correct namespace include set, and this can also not be done from the outside.

Best regards,
Sebastian

#2 Updated by Stefan Neufeind over 1 year ago

Same idea was also mentioned on a presentation by e-net (slide 5):
http://de.slideshare.net/enetinfo/t3ak12-extbase-11562975

Also available in: Atom PDF