From 49143770e5179f930b7acd45dc79d65a56c615d9 Mon Sep 17 00:00:00 2001 From: pollen8 Date: Thu, 9 May 2013 11:42:04 +0200 Subject: [PATCH] fixed: cdd not working if no dbjoin element found on the page --- .../cascadingdropdown/cascadingdropdown.php | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/plugins/fabrik_element/cascadingdropdown/cascadingdropdown.php b/plugins/fabrik_element/cascadingdropdown/cascadingdropdown.php index 26897d7c975..0dfb191e44b 100644 --- a/plugins/fabrik_element/cascadingdropdown/cascadingdropdown.php +++ b/plugins/fabrik_element/cascadingdropdown/cascadingdropdown.php @@ -91,6 +91,26 @@ public function elementJavascript($repeatCounter) return array('FbCascadingdropdown', $id, $opts); } + /** + * Get the class to manage the form element + * if a plugin class requires to load another elements class (eg user for dbjoin then it should + * call FabrikModelElement::formJavascriptClass('plugins/fabrik_element/databasejoin/databasejoin.js', true); + * to ensure that the file is loaded only once + * + * @param array &$srcs Scripts previously loaded (load order is important as we are loading via head.js + * and in ie these load async. So if you this class extends another you need to insert its location in $srcs above the + * current file + * @param string $script Script to load once class has loaded + * + * @return void + */ + + public function formJavascriptClass(&$srcs, $script = '') + { + plgFabrik_Element::formJavascriptClass($srcs, 'plugins/fabrik_element/databasejoin/databasejoin.js'); + parent::formJavascriptClass($srcs, $script); + } + /** * Get the field name to use as the column that contains the join's label data *