Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php namespace Craft;
- class SamplePlugin extends BasePlugin {
- function getName() { ... }
- function getVersion() { ... }
- function getDeveloper() { ... }
- function getDeveloperUrl() { ... }
- public function getSettingsHtml()
- {
- return craft()->templates->render('sample/settings', [
- 'settings' => $this->getSettings()
- ]);
- }
- public function prepSettings($settings)
- {
- // I'm currently doing my 'custom' validation here. But if
- // there's an error, how do I display errors on the settings page?
- return $settings;
- }
- public function rules()
- {
- // Tried this, but since SamplePlugin isn't a Model, it does nothing.
- }
- protected function defineSettings()
- {
- return [
- 'mySetting' => [
- AttributeType::String,
- 'required' => true,
- // Can custom validation rules be set here?
- ]
- ];
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement