FeaturedImage.php
1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php
namespace ACP\Column\Post;
use AC;
use ACP\Editing;
use ACP\Export;
use ACP\Filtering;
use ACP\Search;
use ACP\Settings;
use ACP\Sorting;
/**
* @since 2.0
*/
class FeaturedImage extends AC\Column\Post\FeaturedImage
implements Editing\Editable, Filtering\Filterable, Sorting\Sortable, Export\Exportable, Search\Searchable {
public function sorting() {
if ( 'filesize' === $this->get_display_value() ) {
return new Sorting\Model\Post\FeaturedImageSize( $this->get_meta_key() );
}
return new Sorting\Model\Post\Meta( $this->get_meta_key() );
}
public function filtering() {
if ( 'filesize' === $this->get_display_value() ) {
return new Filtering\Model\Disabled( $this );
}
return new Filtering\Model\Post\FeaturedImage( $this );
}
public function editing() {
return new Editing\Service\Post\FeaturedImage();
}
public function export() {
return new Export\Model\AttachmentURLFromAttachmentId( $this );
}
public function search() {
return new Search\Comparison\Post\FeaturedImage( $this->get_post_type() );
}
public function register_settings() {
$this->add_setting( new Settings\Column\FeaturedImage( $this ) );
}
/**
* @return bool|string
*/
private function get_display_value() {
$setting = $this->get_setting( 'featured_image' );
if ( ! $setting instanceof Settings\Column\FeaturedImage ) {
return false;
}
return $setting->get_featured_image_display();
}
}