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

handler-extensibility #523

Closed
PRGfx opened this issue Aug 7, 2017 · 2 comments
Closed

handler-extensibility #523

PRGfx opened this issue Aug 7, 2017 · 2 comments
Labels

Comments

@PRGfx
Copy link

PRGfx commented Aug 7, 2017

From what I understand, these blocks returned for all the rules (like ['element'=>['name'=>...]]) are processed by one of the handlers (

# Handlers
ff.). (Except the quite common handler line which I don't seem to find.)

As this concept seems to exist, I would expect each element to be rendered by it's handler if specified (like

$markup .= $this->{$Element['handler']}($Element['text']);
but preferably with just $Element rather than needing to overload the text field to supply additional arguments), but maybe I just haven't yet understood the concept here and someone could clarify?

To give an example: I am thinking of an extension with some custom rule which would invoke a bit more markup so that I would like to return something like

return [
  'element' => [
    'handler' => 'template',
    'templateName' => 'someTemplateFile',
    'templateVariables' => [
      // something from my rule
    ]
  ]
];

and then have a handler template(array $options) to generate my markup from a template.

@aidantwoods
Copy link
Collaborator

There's some info in #507 (comment), give me a ping if you need any more info though. You seem to have the gist, handler is the function to call, 'text' is the argument.

@PRGfx
Copy link
Author

PRGfx commented Aug 7, 2017

Thank you for the quick clarification. Putting mixed values into 'text' was a bit unintuitive but does what I need.

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

No branches or pull requests

2 participants