From 402e951b224a778b0e9cf598e44e112e58438439 Mon Sep 17 00:00:00 2001 From: Haralan Dobrev Date: Fri, 6 Dec 2013 18:34:03 +0200 Subject: [PATCH] Add more options to remoteselect form widget --- classes/Kohana/Jam/Form/Tart/General.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/classes/Kohana/Jam/Form/Tart/General.php b/classes/Kohana/Jam/Form/Tart/General.php index 280b16b..c8ba6a7 100644 --- a/classes/Kohana/Jam/Form/Tart/General.php +++ b/classes/Kohana/Jam/Form/Tart/General.php @@ -386,6 +386,7 @@ public function multiselect($name, array $options = array(), array $attributes = 'new_button' => NULL, 'search' => TRUE, 'template' => $template, + 'templatestring' => Arr::get($options, 'templatestring', ''), 'list' => NULL, 'sortable' => NULL, 'label' => strtolower(Inflector::humanize($name)), @@ -395,15 +396,17 @@ public function multiselect($name, array $options = array(), array $attributes = $h('input', array('name' => $attributes['name'].'[]', 'type' => 'hidden', 'value' => '')); - $h('p', function($h) use ($name, $options) { + $h('p', function($h) use ($name, $options, $attributes) { $h('input', array( + 'id' => $attributes['id'], 'type' => 'text', 'placeholder' => Arr::get($options, 'placeholder', 'Search for '.$options['label']), - 'data-provide' => 'remoteselect', + 'data-provide' => Arr::get($options, 'provide', 'remoteselect'), 'data-source' => $options['source'], 'data-container' => '#'.$options['container'], 'data-url' => $options['new'], + 'data-templatestring' => $options['templatestring'], 'style' => $options['search'] ? '' : 'display:none' ));