From 05da471c58e00a1f51b35e83435f88ca4420905f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=AA=20Ho=C3=A0ng=20Ph=C6=B0=C6=A1ng?= Date: Sun, 25 Aug 2013 17:49:53 +0700 Subject: [PATCH] write new position field to mimic the one used in com_modules --- core/fields/position.php | 37 +++++++++++++++++++++++++++++++++++++ templateDetails.xml | 8 ++++---- 2 files changed, 41 insertions(+), 4 deletions(-) create mode 100644 core/fields/position.php diff --git a/core/fields/position.php b/core/fields/position.php new file mode 100644 index 0000000..5fd6515 --- /dev/null +++ b/core/fields/position.php @@ -0,0 +1,37 @@ +load('com_modules', JPATH_ADMINISTRATOR); + + $clientId = 0; + $state = 1; + $selectedPosition = $this->value; + $positions = JHtml::_('modules.positions', $clientId, $state, $selectedPosition); + + + // Add custom position to options + $customGroupText = JText::_('COM_MODULES_CUSTOM_POSITION'); + + // Build field + $attr = array( + 'id' => $this->id, + 'list.select' => $this->value, + 'list.attr' => 'class="chzn-custom-value input-xlarge" ' + . 'data-custom_group_text="' . $customGroupText . '" ' + . 'data-no_results_text="' . JText::_('COM_MODULES_ADD_CUSTOM_POSITION') . '" ' + . 'data-placeholder="' . JText::_('COM_MODULES_TYPE_OR_SELECT_POSITION') . '" ' + ); + + return JHtml::_('select.groupedlist', $positions, $this->name, $attr); + } +} \ No newline at end of file diff --git a/templateDetails.xml b/templateDetails.xml index f4e7977..1f9fc22 100644 --- a/templateDetails.xml +++ b/templateDetails.xml @@ -71,7 +71,7 @@ @@ -262,7 +262,7 @@ @@ -270,7 +270,7 @@ @@ -278,7 +278,7 @@