Skip to content

Commit

Permalink
Support SBL basic sorting
Browse files Browse the repository at this point in the history
By implementing a multilingual compatible version of getFieldSchema() the field can now sort.

Sorting rules are the same as the regular SBL field
  • Loading branch information
nitriques committed Feb 1, 2016
1 parent ba2cd00 commit b952943
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions fields/field.multilingual_selectbox_link.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,25 @@ public function __construct(){
$this->_name = __('Multilingual Select Box Link');
}

protected function getFieldSchema($fieldId) {
$lc = FLang::getLangCode();

if (empty($lc)) {
$lc = FLang::getMainLang();
}

try {
return Symphony::Database()->fetch("
SHOW COLUMNS FROM `tbl_entries_data_$fieldId`
WHERE `Field` in ('value-$lc');
");
}
catch (Exception $ex) {
// bail out
}
return parent::getFieldSchema($fieldId);
}

public function fetchIDfromValue($value) {
$id = null;
$related_field_ids = $this->get('related_field_id');
Expand Down

0 comments on commit b952943

Please sign in to comment.