Keep the same `_options` context on each cascading level using `Renderer::_render`. #817

Merged
merged 1 commit into from Feb 12, 2013

Conversation

Projects
None yet
3 participants
@jails
Contributor

jails commented Feb 7, 2013

No description provided.

@tefra

This comment has been minimized.

Show comment Hide comment
@tefra

tefra Feb 7, 2013

Contributor

On the same #795 talk, there is a second scenario that it's still broken, calling the View::render from a template helper. If the helper is rendering from a different library from element sidebar, the second line fails.

<?php echo $this->helper->doYourMagicAndRender(); ?>
<?php echo $this->_render('element', 'sidebar'); ?>
Contributor

tefra commented Feb 7, 2013

On the same #795 talk, there is a second scenario that it's still broken, calling the View::render from a template helper. If the helper is rendering from a different library from element sidebar, the second line fails.

<?php echo $this->helper->doYourMagicAndRender(); ?>
<?php echo $this->_render('element', 'sidebar'); ?>
@jails

This comment has been minimized.

Show comment Hide comment
@jails

jails Feb 7, 2013

Contributor

I don't understand. If you are using View::render in your helper this mean you're working on a new view instance and should not conflicts. And if you are using $this->_context->_render() in your helper, I don't understand why this PR fail. Any chance having some details on what is done in doYourMagicAndRender() ?

Contributor

jails commented Feb 7, 2013

I don't understand. If you are using View::render in your helper this mean you're working on a new view instance and should not conflicts. And if you are using $this->_context->_render() in your helper, I don't understand why this PR fail. Any chance having some details on what is done in doYourMagicAndRender() ?

@tefra

This comment has been minimized.

Show comment Hide comment
@tefra

tefra Feb 7, 2013

Contributor

I didn't mean i was creating a new view instance, sry if i wasn't clear, here is a proper snippet

public function doYourMagicAndRender() {
    return $this->_context->view()->render(array('element' => 'elementName'), array(), array('library' => 'libraryName'));
}
Contributor

tefra commented Feb 7, 2013

I didn't mean i was creating a new view instance, sry if i wasn't clear, here is a proper snippet

public function doYourMagicAndRender() {
    return $this->_context->view()->render(array('element' => 'elementName'), array(), array('library' => 'libraryName'));
}
@jails

This comment has been minimized.

Show comment Hide comment
@jails

jails Feb 8, 2013

Contributor

The defaults options are passed to View::render by the controller. Calling $this->_context->view()->render reset all default options with the one passed. If you simply do $this->_context->_render() the context should be kept. I don't know how we can patch the core better than this to keep "contextualized _options" even if View::render is directly called.

Contributor

jails commented Feb 8, 2013

The defaults options are passed to View::render by the controller. Calling $this->_context->view()->render reset all default options with the one passed. If you simply do $this->_context->_render() the context should be kept. I don't know how we can patch the core better than this to keep "contextualized _options" even if View::render is directly called.

nateabele added a commit that referenced this pull request Feb 12, 2013

Merge pull request #817 from jails/feature/renderer-options
Keep the same `_options` context on each cascading level using `Renderer::_render`.

@nateabele nateabele merged commit ba19920 into UnionOfRAD:dev Feb 12, 2013

1 check passed

default The Travis build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment