The Definitive Guide to Craft Validation for Plugin Developers
This book is 100% complete
Completed on 2015-05-14
About the Book
If you're working on a Craft plugin that accepts user input, chances are you'll want to validate that data. Thanks to its Yii underpinnings, Craft includes lots of powerful validation features as standard, but they're not always easy to use or understand.
In an attempt to help us out, Craft adds its own layer of abstraction on top of the Yii validation tools. This makes the syntax a bit more consistent and approachable, but also renders the associated Yii documentation useless. Worse still, the official Craft documentation is currently rather lacking in this area.
That's where this book comes in. It provides a complete guide to validation in Craft 2, all the way from the high-level concepts, right down to the nuts and bolts of implementation.
If you want to know how to implement validation in your Craft plugin as quickly and effectively as possible, you're in the right place.
- The Obligatory Origin Story
- Is This Book For Me?
- Get In Touch
- How To Declare A Model Attribute
- How To Validate A Model’s Attributes
- Useful Validation Methods
- The Many Roles of AttributeTypes
- How AttributeTypes Affect Validation
- Overriding The Default AttributeType Validator Parameters
- Available AttributeTypes
3. Attribute Rules
- Available Attribute Validation Rules
4. Hidden Validator Settings
- How To Use A Hidden Validator Setting
- A Yii Validation Rule Primer
- Available Hidden Validator Settings
5. Custom Validators
- How To Tell Craft To Use A Custom Validator
- How To Implement A Custom Validator
- Appendix A: Reserved “Handle” Words
- About The Author
The Leanpub 45-day 100% Happiness Guarantee
Within 45 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.
See full terms...