![]() |
|
sfDoctrineSettingsPlugin - 1.2.4Allows for settings to stored in the database and recalled for use in the application. |
|
![]() |
6
users
Sign-in
to change your status |
The sfDoctrineSettingsPlugin is a symfony plugin that provides app wide settings functionality. It automatically generates constant values based on sf_setting table values and make them accessible in every app module. |
The sfDoctrineSettingsPlugin is a symfony plugin that provides app wide settings functionality. It automatically generates constant values based on sf_setting table values and make them accessible in every app module.
| Name | Status | |
|---|---|---|
|
|
lead | moc.sngisedbewos <<ta>> wortsos |
|
|
lead | moc.ecanys <<ta>> ynofmys |
|
|
developer | moc.liamg <<ta>> egawnoj |
Copyright (c) 2007 Chris Wage
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
| Version | License | API | Released |
|---|---|---|---|
| 1.2.4stable | MIT license | 1.2.0stable | 22/02/2009 |
| 1.2.3stable | MIT license | 1.2.0stable | 22/02/2009 |
| 1.2.2stable | MIT license | 1.2.0stable | 22/02/2009 |
| 1.2.1stable | MIT license | 1.2.0stable | 09/02/2009 |
| 1.2.0stable | MIT license | 0.1.0stable | 01/02/2009 |
| Version | License | API | Released |
|---|---|---|---|
| 1.0.5stable | MIT license | 0.1.0stable | 19/12/2008 |
| 1.0.4stable | MIT license | 0.1.0stable | 09/12/2008 |
| 1.0.3stable | MIT license | 0.1.0stable | 02/12/2008 |
| 1.0.2stable | MIT license | 0.1.0stable | 18/11/2008 |
| 1.0.1stable | MIT license | 0.1.0stable | 08/11/2008 |
Upgrading the plugin to make it work with 1.2
Removing the save button from the list view if we're not using the single page display
Making the generator file look at a app.yml setting to decide whether to have the values editable on the list page or the edit page.
Changing my email on this package
This plugin allows the easy use of a basic dynamic settings table. It will create sf_settings, and allow the use of an admin generator interface (via the sfSettings module) in order to add/edit/delete settings.
Since loading a setting requires a query to the database, performance ramifications are best mitigated by using sfSettings:load() to pre-load settings in the action for use elsewhere, i.e.:
<?php sfSettings::load(array('setting1', 'setting2', 'setting3'));
If you have settings that you know you will want loaded by default for every action, you can put those in config/defaults.yml.
# /config/defaults.yml settings: [ setting_name_1, setting_name_2 ]
However you will also need to add a filter to the chain so that your settings get loaded, i.e. the following lines at the top of appname/config/filters.yml:
# /apps/public/config/filters.yml settings: class: sfSettingsFilter
After the settings have been loaded, they are stored in memory for retrieval by sfSettings::get() (returns a string value) or sfSettings::getSetting() (returns an sfSetting object)
A admin/backend module also exists for managing the settings in the database. you must enable the module in order to access it
# /apps/backend/config/settings.yml
all:
.settings:
enabled_modules: [default, sfSettings]
In order to use the WYSIWYG field you must install sfFormExtraPlugin as well as the TINYMCE editor. After your app.yml file to tell the plugin to use the rich text editor
# /apps/backend/config/app.yml
all:
sf_settings_plugin:
rich_fields: false
When using the checkbox and select types you must use the options field to specify valid options for the value. The options field should be filled out as an arry in yaml format
# options field for types select and checkbox value: 'The Label' option2: 'Option 2'
If you would like to add more types of options to the sfSettingsPlugin you can override the $type_choices variable in your model.
# /lib/model/doctrine/sfSettingsPlugin/sfSettingTable.class.php protected static $type_choices = array( 'checkbox' => 'Checkbox', 'input' => 'Text Field', 'textarea' => 'Text Area', 'wysiwyg' => 'Rich Text Area', 'yesno' => 'Yes/No Radios', 'select' => 'Select', 'newCustomType' => 'New Custom Type',);
If you would like to set a custom widget for the value field when using this type make a new class in your project named sfSettingsSettingNewCustomTypeForm The example below is making the value field a Select box of choices from the options field
# /lib/form/sfSettingsSettingCheckboxForm.class.php class sfSettingsSettingNewCustomTypeForm extends sfSettingForm { public function configure() { parent::configure(); $choices = sfYaml::load($this->getObject()->getOptions()); if ( is_array($choices) && count($choices) ) { $this->widgetSchema['value'] = new sfWidgetFormChoice(array('choices' => $choices)); $this->validatorSchema['value'] = new sfValidatorChoice(array('choices' => array_keys($choices))); } else { unset($this['value']); } } }
rich=true