Skip to content

Commit

Permalink
Added sorting as the Pages admin area
Browse files Browse the repository at this point in the history
  • Loading branch information
designermonkey committed Aug 24, 2013
1 parent 31df53d commit 4b9580c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
8 changes: 6 additions & 2 deletions README.md
@@ -1,6 +1,6 @@
# Page Select Box Field

- Version: 1.5
- Version: 1.6
- Author: Symphony Team (team@symphony21.com)
- Build Date: 5th July, 2012
- Requirements: Symphony 2.3
Expand All @@ -11,4 +11,8 @@

2. Enable it by selecting the "Field: Page Select Box", choose Enable from the with-selected menu, then click Apply.

3. You can now add the "Page Select Box" field to your sections.
3. You can now add the "Page Select Box" field to your sections.

## Sorting

The field sorts the pages according to the sortorder determined in 'Blueprints » Pages'. If the sorting isn't correct, it's probably because of the sortorder. To set the sortorder of your pages, edit your config.php-file, set symphony/pages_table_nest_children to yes, and sort the pages manually in your pages screen. When done, you can set symphony/pages_table_nest_children back to no (or keep it on yes, if that is your prefered way of working).
5 changes: 4 additions & 1 deletion extension.meta.xml
Expand Up @@ -13,9 +13,12 @@
</author>
</authors>
<releases>
<release version="1.6" date="2013-08-24" min="2.3">
- Added request for sorting to be the same as the sort order under the Pages admin area.
</release>
<release version="1.5" date="2012-06-05" min="2.3">
- Update for Symphony 2.3
</release>
<release version="1.4.1" date="2011-12-02" min="2.0.6" max="2.2.x" />
</releases>
</extension>
</extension>
3 changes: 2 additions & 1 deletion fields/field.pages.php
Expand Up @@ -403,7 +403,8 @@ public function buildDSRetrievalSQL($data, &$joins, &$where, $andOperation = fal

public function buildSortingSQL(&$joins, &$where, &$sort, $order='ASC'){
$joins .= "INNER JOIN `tbl_entries_data_".$this->get('id')."` AS `ed` ON (`e`.`id` = `ed`.`entry_id`) ";
$sort .= 'ORDER BY ' . (strtolower($order) == 'random' ? 'RAND()' : "`ed`.`handle` $order");
$joins .= "INNER JOIN `tbl_pages` ON (`tbl_pages`.`id` = `$sort_field`.`page_id`) ";
$sort .= "ORDER BY " . (strtolower($order) == 'random' ? 'RAND()' : "`tbl_pages`.`sortorder` $order");
}

/*-------------------------------------------------------------------------
Expand Down

0 comments on commit 4b9580c

Please sign in to comment.