public function ActivityPlugin::addOrderBy in Activity 8
File
- src/
Plugin/ views/ query/ ActivityPlugin.php, line 175
Class
- ActivityPlugin
- Activity views query plugin which display all activities.
Namespace
Drupal\activity\Plugin\views\queryCode
public function addOrderBy($table, $field, $order = 'ASC', $alias = '', $params = []) {
// Only ensure the table if it's not the special random key.
// @todo: Maybe it would make sense to just add an addOrderByRand or something similar.
if ($table && $table != 'rand') {
$this
->ensureTable($table);
}
// Only fill out this aliasing if there is a table;
// otherwise we assume it is a formula.
if (!$alias && $table) {
$as = $table . '_' . $field;
}
else {
$as = $alias;
}
if ($field) {
$as = $this
->addField($table, $field, $as, $params);
}
if ($this->activities instanceof Select) {
$this->activities
->orderBy($as, strtoupper($order));
}
}