AlbumFactory.php
2 days ago
AlternateTextFactory.php
2 days ago
ArtistFactory.php
2 days ago
AudioPlayerFactory.php
2 days ago
AvailableSizesFactory.php
2 days ago
CaptionFactory.php
2 days ago
DimensionsFactory.php
2 days ago
DownloadFactory.php
2 days ago
ExifDataFactory.php
2 days ago
FileMetaAudioFactory.php
2 days ago
FileMetaVideoFactory.php
2 days ago
FileNameFactory.php
2 days ago
FileSizeFactory.php
2 days ago
FullPathFactory.php
2 days ago
HeightFactory.php
2 days ago
ImageFactory.php
2 days ago
MimeTypeFactory.php
2 days ago
PreviewFactory.php
2 days ago
VideoPlayerFactory.php
2 days ago
WidthFactory.php
2 days ago
CaptionFactory.php
49 lines
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace AC\ColumnFactory\Media; |
| 6 | |
| 7 | use AC\Column\BaseColumnFactory; |
| 8 | use AC\Formatter\Post\Excerpt; |
| 9 | use AC\FormatterCollection; |
| 10 | use AC\Setting\ComponentCollection; |
| 11 | use AC\Setting\ComponentFactory\StringLimit; |
| 12 | use AC\Setting\Config; |
| 13 | use AC\Setting\DefaultSettingsBuilder; |
| 14 | |
| 15 | class CaptionFactory extends BaseColumnFactory |
| 16 | { |
| 17 | private StringLimit $string_limit; |
| 18 | |
| 19 | public function __construct(DefaultSettingsBuilder $default_settings_builder, StringLimit $string_limit) |
| 20 | { |
| 21 | parent::__construct( |
| 22 | $default_settings_builder |
| 23 | ); |
| 24 | $this->string_limit = $string_limit; |
| 25 | } |
| 26 | |
| 27 | public function get_column_type(): string |
| 28 | { |
| 29 | return 'column-caption'; |
| 30 | } |
| 31 | |
| 32 | public function get_label(): string |
| 33 | { |
| 34 | return __('Caption', 'codepress-admin-columns'); |
| 35 | } |
| 36 | |
| 37 | protected function get_settings(Config $config): ComponentCollection |
| 38 | { |
| 39 | return parent::get_settings($config)->add($this->string_limit->create($config)); |
| 40 | } |
| 41 | |
| 42 | protected function get_formatters(Config $config): FormatterCollection |
| 43 | { |
| 44 | return parent::get_formatters($config) |
| 45 | ->prepend(new Excerpt()); |
| 46 | } |
| 47 | |
| 48 | } |
| 49 |