/** * This function returns the sort parameter for a column if this column should be sortable in the table. * * @since 0.6.1 * @param string $slug the column slug * @param array $args the column arguments * @return string|null|false either the column sort parameter, null for no changes or false to remove the column if it exists */ protected function filter_table_sortable_column($slug, $args) { if (!is_array($args)) { return false; } if (isset($args['taxonomy_slug']) && !empty($args['taxonomy_slug'])) { if ($args['sortable'] && is_object_in_taxonomy($this->component->slug, $args['taxonomy_slug'])) { return is_string($args['sortable']) && 'desc' === strtolower($args['sortable']) ? array($slug, true) : array($slug, false); } } return parent::filter_table_sortable_column($slug, $args); }
/** * Class constructor. * * @since 0.6.0 * @param WPPTD\Components\Taxonomy $taxonomy the taxonomy component to use this handler for * @param null $query_handler only for parent class, must not be used here * @param null $action_handler only for parent class, must not be used here */ public function __construct($taxonomy, $query_handler = null, $action_handler = null) { parent::__construct($taxonomy, new TaxonomyQueryHandler($taxonomy), new TaxonomyActionHandler($taxonomy)); }