Author: ornicar2
Date: 2010-02-11 14:32:10 +0100 (Thu, 11 Feb 2010)
New Revision: 27891
Modified:
plugins/dmTagPlugin/config/dmTagPluginConfiguration.class.php
Log:
[Diem][dmTagPlugin]
- used form.post_configure event to add "tags" widget and validator to admin
forms
Modified: plugins/dmTagPlugin/config/dmTagPluginConfiguration.class.php
===================================================================
--- plugins/dmTagPlugin/config/dmTagPluginConfiguration.class.php
2010-02-11 13:24:24 UTC (rev 27890)
+++ plugins/dmTagPlugin/config/dmTagPluginConfiguration.class.php
2010-02-11 13:32:10 UTC (rev 27891)
@@ -15,8 +15,27 @@
{
dmDb::table($model);
}
+
+ if($this->configuration instanceof dmAdminApplicationConfiguration)
+ {
+ $this->dispatcher->connect('form.post_configure', array($this,
'listenToFormPostConfigureEvent'));
+ }
}
+ public function listenToFormPostConfigureEvent(sfEvent $event)
+ {
+ $form = $event->getSubject();
+
+ if($form instanceof dmFormDoctrine &&
$form->getObject()->getTable()->hasTemplate('DmTaggable'))
+ {
+ $form->setWidget('tags', new sfWidgetFormDmTagsAutocomplete(
+ array('choices' => $form->getObject()->getTagNames())
+ ));
+
+ $form->setValidator('tags', new sfValidatorDmTagsAutocomplete());
+ }
+ }
+
/**
* @param sfCache $cache
* @return array models that act as DmTaggable
--
You received this message because you are subscribed to the Google Groups
"symfony SVN" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/symfony-svn?hl=en.