Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Append/Prepend Options For t:block #53

Open
abcarroll opened this issue Mar 15, 2017 · 1 comment
Open

Append/Prepend Options For t:block #53

abcarroll opened this issue Mar 15, 2017 · 1 comment

Comments

@abcarroll
Copy link

abcarroll commented Mar 15, 2017

Hello! I really enjoy what you've done here.

I'm in the process of re-doing a very large commercial CMS system with twig. After finding twital, -- I'm going to switch it to twital as well so we can begin taking advantage of it's features as well.

One thing I plan on forking/adding is a way to prepend/append to <t:block's, -- I've always thought the {{ parent() }} call was so ugly. If you aren't interested in a feature, -- no worries, I'll maintain my own fork.

However, if you are, ... do you have any suggestions for the syntax? It'll be later this week before I can get to it, but looking at the twital code it should be just a few lines.

It could be a few different ways: ... <t:block name="foo" type="append"> ... <t:blockappend name="foo"> ... or my favorite <t:block append="foo"> with the attributes of replace="name", prepend="name" and append="name" ...

What do you think?

edit: totally missed a sentence

@goetas
Copy link
Owner

goetas commented Mar 15, 2017

Hi
I'm glad to hear that you liked my project 😄

Regarding your question:

  1. Probably you will not need to fork the project, you add your own extension to it and register it via extension mechanism. Currently all the twital features are implemented using the same mechanism.
    Have a look at the Extension folder in the repo. You can see that also the current block system is implemented in the same way. Here you can find how to register your own extension.

  2. Regarding the feature you suggested, the syntax that i like the most is <t:block name="foo" type="append">. That obviously will also have <t:block name="foo" type="prepend"> and <t:block name="foo"> that will be the original implementation.
    To be honest, I do not see a big advantage in the feature, Of course not having the full picture that you have, and the reasons behind it, probably my position is definitively flexible.
    Have a looks also the the already implemented t:block-inner and t:block-outer attributes (docs are still missing), they might give you a bigger picture on the "block" problems.

Are you using the library as standalone or with some framework? (symfony?)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants