AgentFactory.php
3 months ago
ApprovedFactory.php
3 months ago
AuthorAvatarFactory.php
3 months ago
AuthorEmailFactory.php
3 months ago
AuthorIpFactory.php
3 months ago
AuthorNameFactory.php
3 months ago
AuthorUrlFactory.php
3 months ago
CommentTypeFactory.php
3 months ago
DateGmtFactory.php
3 months ago
ExcerptFactory.php
3 months ago
IdFactory.php
3 months ago
PostFactory.php
3 months ago
ReplyToFactory.php
3 months ago
StatusFactory.php
3 months ago
UserFactory.php
3 months ago
WordCountFactory.php
3 months ago
PostFactory.php
54 lines
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace AC\ColumnFactory\Comment; |
| 6 | |
| 7 | use AC\Column\BaseColumnFactory; |
| 8 | use AC\Formatter\Comment\Property; |
| 9 | use AC\FormatterCollection; |
| 10 | use AC\Setting\ComponentCollection; |
| 11 | use AC\Setting\ComponentFactory\LinkablePostProperty; |
| 12 | use AC\Setting\Config; |
| 13 | use AC\Setting\DefaultSettingsBuilder; |
| 14 | |
| 15 | class PostFactory extends BaseColumnFactory |
| 16 | { |
| 17 | |
| 18 | private LinkablePostProperty $post_property; |
| 19 | |
| 20 | public function __construct( |
| 21 | DefaultSettingsBuilder $default_settings_builder, |
| 22 | LinkablePostProperty $post_property |
| 23 | ) { |
| 24 | parent::__construct($default_settings_builder); |
| 25 | |
| 26 | $this->post_property = $post_property; |
| 27 | } |
| 28 | |
| 29 | public function get_label(): string |
| 30 | { |
| 31 | return __('Post', 'codepress-admin-columns'); |
| 32 | } |
| 33 | |
| 34 | protected function get_settings(Config $config): ComponentCollection |
| 35 | { |
| 36 | return new ComponentCollection([ |
| 37 | $this->post_property->create($config), |
| 38 | ]); |
| 39 | } |
| 40 | |
| 41 | public function get_column_type(): string |
| 42 | { |
| 43 | return 'column-post'; |
| 44 | } |
| 45 | |
| 46 | protected function get_formatters(Config $config): FormatterCollection |
| 47 | { |
| 48 | $formatters = parent::get_formatters($config); |
| 49 | $formatters->prepend(new Property('comment_post_ID')); |
| 50 | |
| 51 | return $formatters; |
| 52 | } |
| 53 | |
| 54 | } |