1

I have different templates.

  • default
  • category
  • article
  • overview

They share some properties like the text-editor with it's settings.

<property name="article" type="text_editor">
    <meta>
        <title lang="de">Inhalt</title>
        <title lang="en">Content</title>
    </meta>
    <params>
        <param name="table" value="true"/>
        <param name="link" value="true"/>
        <param name="paste_from_word" value="true"/>
        <param name="height" value="200"/>
        <param name="max_height" value="2000"/>
        <!-- CKEditor Parameters examples: -->
        <param name="extra_allowed_content" value="img(*)[*]; span(*)[*]; div(*)[*]; iframe(*)[*]; script(*)[*]" />
    </params>
</property>

I don't want to duplicate the configuration and instead link it from somewhere? I did not find anything about it in the Sulu-Docs, but I'm sure there is a solution for this.

Emii Khaos
  • 9,983
  • 3
  • 34
  • 57
Patrick
  • 1,562
  • 1
  • 16
  • 33

2 Answers2

0

I don't know the Sulu tool but in symfony if you want to factoring code in twig template, you can use the macro twig : Twig macro doc

  1. create a macro file in twig format
  2. import macro file in your template specific page
  3. use a macro in your macro file with call the name of the macro (not the file but the inside macro name file)

With this you can also call the function macro with parameter. For each page generate call this macro with few differents aspects for generate few differents party of this factoring code.

miltone
  • 4,416
  • 11
  • 42
  • 76
  • Thanks for the answer. This is not a twig template, it is a configuration item formatted in XML. – Patrick Dec 31 '15 at 10:08
0

We've already been thinking about some kind of import functionality, but we haven't implemented that yet, and it has not the highest priority, and would make certain things a bit more complex.

But what you could do until then, is to inherit from the TextEditor Content Type, put your default values in there, register it as a new content type, and use this one instead. Then you would at least save typing the parameters all the time.

If you like you might also be able to use Symfony's Bundle Inheritance feature.

Daniel Rotter
  • 1,998
  • 2
  • 16
  • 33