philipbrown / magniloquent

DEPRECATED, USE https://github.com/dwightwatson/validating
MIT License
70 stars 8 forks source link

Convert niceNames to method to allow localization #35

Closed Propaganistas closed 10 years ago

Propaganistas commented 10 years ago

Hi

niceNames are currently implemented as class properties. These are inherently constrained by PHP to not allow dynamic value calculation and therefore dynamic values like using trans() cannot be defined.

By referencing the niceNames array in the setAttributeNames call as a method, a simple override of niceNames() is available to support dynamic values. If not overridden, legacy support is preserved as it just returns the $niceNames property by default.

The docs should probably be updated to suggest using the method.

philipbrown commented 10 years ago

Thank you :)

Propaganistas commented 10 years ago

You're welcome. As a reminder: please do not forget to update the docs.

philipbrown commented 10 years ago

Docs pull requests also welcome ;)

Propaganistas commented 10 years ago

Check new pull request.