/** * Called if a column does not have a method that provides logic for * rendering that column. * * @param Batch $batch * @param array $column_name * @return string Text or HTML to be placed inside the column. */ public function column_default($batch, $column_name) { // Display name of user who created the batch. $display_name = ''; if ($batch->get_creator() !== null) { $display_name = $batch->get_creator()->get_display_name(); } switch ($column_name) { case 'post_modified': return $batch->get_modified(); case 'post_author': return $display_name; default: return ''; } }
/** * Called if a column does not have a method that provides logic for * rendering that column. * * @param Batch $item * @param array $column_name * @return string Text or HTML to be placed inside the column. */ public function column_default($item, $column_name) { switch ($column_name) { case 'post_modified': return $item->get_modified(); case 'post_author': return $item->get_creator()->get_display_name(); default: return ''; } }
/** * Sort batches by the display name of batch creators. * * @param Batch $a * @param Batch $b * @return int */ private function post_author_sort(Batch $a, Batch $b) { return $a->get_creator()->get_display_name() == $b->get_creator()->get_display_name() ? 0 : $a->get_creator()->get_display_name() > $b->get_creator()->get_display_name() ? 1 : -1; }