| 1 |
<?php |
| 2 |
|
| 3 |
declare(strict_types=1); |
| 4 |
|
| 5 |
namespace Give\DonationForms\V2\ListTable\Columns; |
| 6 |
|
| 7 |
use Give\DonationForms\V2\Models\DonationForm; |
| 8 |
use Give\Framework\ListTable\ModelColumn; |
| 9 |
use Give\Helpers\Language; |
| 10 |
|
| 11 |
/** |
| 12 |
* @since 2.24.0 |
| 13 |
* |
| 14 |
* @extends ModelColumn<DonationForm> |
| 15 |
*/ |
| 16 |
class TitleColumn extends ModelColumn |
| 17 |
{ |
| 18 |
|
| 19 |
protected $sortColumn = 'title'; |
| 20 |
|
| 21 |
/** |
| 22 |
* @since 2.24.0 |
| 23 |
* |
| 24 |
* @inheritDoc |
| 25 |
*/ |
| 26 |
public static function getId(): string |
| 27 |
{ |
| 28 |
return 'title'; |
| 29 |
} |
| 30 |
|
| 31 |
/** |
| 32 |
* @since 2.24.0 |
| 33 |
* |
| 34 |
* @inheritDoc |
| 35 |
*/ |
| 36 |
public function getLabel(): string |
| 37 |
{ |
| 38 |
return __('Name', 'give'); |
| 39 |
} |
| 40 |
|
| 41 |
/** |
| 42 |
* @since 3.22.0 Add locale support |
| 43 |
* @since 3.0.0 remove html tags from title |
| 44 |
* @since 2.24.0 |
| 45 |
* |
| 46 |
* @inheritDoc |
| 47 |
* |
| 48 |
* @param DonationForm $model |
| 49 |
*/ |
| 50 |
public function getCellValue($model): string |
| 51 |
{ |
| 52 |
return sprintf( |
| 53 |
'<a href="%s" rel="noopener noreferrer" class="giveDonationFormsLink" title="%s">%s</a>', |
| 54 |
add_query_arg(['locale' => Language::getLocale()], get_edit_post_link($model->id)), |
| 55 |
esc_attr($model->title), |
| 56 |
wp_strip_all_tags($model->title) |
| 57 |
); |
| 58 |
} |
| 59 |
} |
| 60 |
|