ID.php
12 years ago
actions.php
12 years ago
attachment-count.php
12 years ago
attachment.php
12 years ago
author-name.php
12 years ago
before-moretag.php
12 years ago
comment-count.php
12 years ago
comment-status.php
12 years ago
excerpt.php
12 years ago
featured-image.php
12 years ago
formats.php
12 years ago
modified.php
12 years ago
order.php
12 years ago
page-template.php
12 years ago
parent.php
12 years ago
ping-status.php
12 years ago
roles.php
12 years ago
slug.php
12 years ago
status.php
12 years ago
sticky.php
12 years ago
taxonomy.php
12 years ago
word-count.php
12 years ago
attachment.php
47 lines
| 1 | <?php |
| 2 | /** |
| 3 | * CPAC_Column_Post_Attachment |
| 4 | * |
| 5 | * @since 2.0.0 |
| 6 | */ |
| 7 | class CPAC_Column_Post_Attachment extends CPAC_Column { |
| 8 | |
| 9 | function __construct( $storage_model ) { |
| 10 | |
| 11 | $this->properties['type'] = 'column-attachment'; |
| 12 | $this->properties['label'] = __( 'Attachment', 'cpac' ); |
| 13 | |
| 14 | // define additional options |
| 15 | $this->options['image_size'] = ''; |
| 16 | $this->options['image_size_w'] = 80; |
| 17 | $this->options['image_size_h'] = 80; |
| 18 | |
| 19 | parent::__construct( $storage_model ); |
| 20 | } |
| 21 | |
| 22 | /** |
| 23 | * @see CPAC_Column::get_value() |
| 24 | * @since 2.0.0 |
| 25 | */ |
| 26 | function get_value( $post_id ) { |
| 27 | |
| 28 | $attachment_ids = get_posts( array( |
| 29 | 'post_type' => 'attachment', |
| 30 | 'numberposts' => -1, |
| 31 | 'post_status' => null, |
| 32 | 'post_parent' => $post_id, |
| 33 | 'fields' => 'ids' |
| 34 | )); |
| 35 | |
| 36 | return implode( $this->get_thumbnails( $attachment_ids, $this->options ) ); |
| 37 | } |
| 38 | |
| 39 | /** |
| 40 | * @see CPAC_Column::display_settings() |
| 41 | * @since 2.0.0 |
| 42 | */ |
| 43 | function display_settings() { |
| 44 | |
| 45 | $this->display_field_preview_size(); |
| 46 | } |
| 47 | } |