Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Jan 8, 2020. It is now read-only.

Adds more config to FormCollection-ViewHelper#5565

Closed
heiglandreas wants to merge 8 commits into
zendframework:masterfrom
heiglandreas:feature/makeCollectionConfigurable
Closed

Adds more config to FormCollection-ViewHelper#5565
heiglandreas wants to merge 8 commits into
zendframework:masterfrom
heiglandreas:feature/makeCollectionConfigurable

Conversation

@heiglandreas
Copy link
Copy Markdown
Member

This commit adds more configuration options to the
FormCollection-ViewHelper.

The hard-coded fieldset-wrapper is now configurable as is the hard-coded
legend as well as the hard-coded position and template of the
template-provider. The defaults have been set to the currently
hard-coded values, so that no BC-break should happen.

Also the behaviour of the template-renderer has been changed in so far
as the template is now rendered using the collection-object and not the
content of the collection-object

THis might be a case of BC-Break in edge-cases but the current
default-behaviour as provided by the unit-tests is not broken.

No tests have been changed, there have only been additions

@franz-deleon
Copy link
Copy Markdown
Contributor

this would allow the form collection fieldset tag to be editable correct?

@heiglandreas
Copy link
Copy Markdown
Member Author

Correct. You can then for instance replace the fieldset tag by using the following code:

$view->formCollection()->setWrapper('<div>%1$s</div>')->setShouldWrap(true);

This will then wrap the collection into a <div>-Tag and will remove any label (%2$s) or template (%3$s)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think calling in current class can be call directly $this->labelWrapper

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it adds a degree of flexibility to have a getter. Don't have many use cases though

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Ocramius the use case is on 9c4d5df that we already have getRequest() and getResponse() function, but use $this->request and $this->response directly.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As currently in render() and renderTemplate() also getters are used (see lines 106ff and 160ff), I decided to use getters instead of calling the property directly. Otherwise I would have to rewrite the complete class to make it consistent. Wouldn't be a problem though.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@heiglandreas if you agree with me, I think you should only change the related with the PR to avoid confusion :)

@fabiocarneiro
Copy link
Copy Markdown
Contributor

Hey guys. Since you're working with form collections, would you mind taking a look at this issue? #5502 . I already tried to fix that myself, but i wasnt able.

@heiglandreas heiglandreas deleted the feature/makeCollectionConfigurable branch January 14, 2014 11:23
@heiglandreas heiglandreas reopened this Jan 14, 2014
Andreas Heigl added 5 commits January 14, 2014 12:28
This commit adds more configuration options to the
FormCollection-ViewHelper.

The hard-coded fieldset-wrapper is now configurable as is the hard-coded
legend as well as the hard-coded position and template of the
template-provider. The defaults have been set to the currently
hard-coded values, so that no BC-break should happen.

Also the behaviour of the template-renderer has been changed in so far
as the template is now rendered using the collection-object and not the
content of the collection-object

THis might be a case of BC-Break in edge-cases but the current
default-behaviour as provided by the unit-tests is not broken.

No tests have been changed, there have only been additions
THis aims to a better CodeCoverage
@heiglandreas heiglandreas reopened this Jan 14, 2014
@heiglandreas
Copy link
Copy Markdown
Member Author

I'll open a new PR

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants