Skip to content

v3.0 #98

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 9 commits into
base: master
Choose a base branch
from
Draft

v3.0 #98

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/vendor
.phpunit.result.cache
coverage.xml
/coverage
67 changes: 67 additions & 0 deletions src/Column.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?php

namespace PostTypes;

use PostTypes\Contracts\ColumnContract;

abstract class Column implements ColumnContract
{
/**
* Returns the column name.
*
* @return string
*/
abstract public function name(): string;

/**
* Returns the column label.
*
* @return string
*/
public function label(): string
{
return ucfirst(str_replace(['_', '-'], ' ', $this->name()));
}

/**
* Populate the column.
*
* @param integer $objectId
* @return void
*/
public function populate(int $objectId): void
{
return;
}

/**
* Set the column order.
*
* @return integer|null
*/
public function order(): ?int
{
return null;
}

/**
* Handle sorting the column.
*
* @param \WP_Query|\WP_Term_Query $query
* @return void
*/
public function sort($query)
{
return;
}

/**
* Can the column be sorted.
*
* @return boolean
*/
public function isSortable(): bool
{
return false;
}
}
Loading