AttachmentFactory.php
3 months ago
AuthorFactory.php
3 months ago
BeforeMoreFactory.php
3 months ago
CommentCountFactory.php
3 months ago
CommentStatusFactory.php
3 months ago
ContentFactory.php
3 months ago
DatePublishFactory.php
3 months ago
DepthFactory.php
3 months ago
DiscussionFactory.php
3 months ago
EstimateReadingTimeFactory.php
3 months ago
ExcerptFactory.php
3 months ago
FeaturedImageFactory.php
3 months ago
FormatsFactory.php
3 months ago
IdFactory.php
3 months ago
LastModifiedAuthorFactory.php
3 months ago
LastModifiedFactory.php
3 months ago
MenuFactory.php
3 months ago
OrderFactory.php
3 months ago
PageTemplateFactory.php
3 months ago
ParentFactory.php
3 months ago
PasswordProtectedFactory.php
3 months ago
PathFactory.php
3 months ago
PermalinkFactory.php
3 months ago
PingStatusFactory.php
3 months ago
ShortLinkFactory.php
3 months ago
ShortcodesFactory.php
3 months ago
SlugFactory.php
3 months ago
StatusFactory.php
3 months ago
StickyFactory.php
3 months ago
TaxonomyFactory.php
3 months ago
TitleRawFactory.php
3 months ago
WordCountFactory.php
3 months ago
LastModifiedAuthorFactory.php
62 lines
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace AC\ColumnFactory\Post; |
| 6 | |
| 7 | use AC\Column\BaseColumnFactory; |
| 8 | use AC\Formatter\Post\LastModifiedAuthor; |
| 9 | use AC\FormatterCollection; |
| 10 | use AC\Setting\ComponentCollection; |
| 11 | use AC\Setting\ComponentFactory\UserLinkFactory; |
| 12 | use AC\Setting\ComponentFactory\UserProperty; |
| 13 | use AC\Setting\Config; |
| 14 | use AC\Setting\DefaultSettingsBuilder; |
| 15 | use AC\Type\PostTypeSlug; |
| 16 | |
| 17 | class LastModifiedAuthorFactory extends BaseColumnFactory |
| 18 | { |
| 19 | |
| 20 | private UserProperty $user_factory; |
| 21 | |
| 22 | private UserLinkFactory $user_link; |
| 23 | |
| 24 | private PostTypeSlug $post_type; |
| 25 | |
| 26 | public function __construct( |
| 27 | DefaultSettingsBuilder $default_settings_builder, |
| 28 | UserProperty $user_factory, |
| 29 | UserLinkFactory $user_link, |
| 30 | PostTypeSlug $post_type |
| 31 | ) { |
| 32 | parent::__construct($default_settings_builder); |
| 33 | |
| 34 | $this->user_factory = $user_factory; |
| 35 | $this->user_link = $user_link; |
| 36 | $this->post_type = $post_type; |
| 37 | } |
| 38 | |
| 39 | public function get_column_type(): string |
| 40 | { |
| 41 | return 'column-last_modified_author'; |
| 42 | } |
| 43 | |
| 44 | public function get_label(): string |
| 45 | { |
| 46 | return __('Last Modified Author', 'codepress-admin-columns'); |
| 47 | } |
| 48 | |
| 49 | protected function get_settings(Config $config): ComponentCollection |
| 50 | { |
| 51 | return new ComponentCollection([ |
| 52 | $this->user_factory->create($config), |
| 53 | $this->user_link->create($this->post_type)->create($config), |
| 54 | ]); |
| 55 | } |
| 56 | |
| 57 | protected function get_formatters(Config $config): FormatterCollection |
| 58 | { |
| 59 | return parent::get_formatters($config)->prepend(new LastModifiedAuthor()); |
| 60 | } |
| 61 | |
| 62 | } |