ID.php
10 years ago
actions.php
10 years ago
alternate-text.php
10 years ago
attached-to.php
10 years ago
available-sizes.php
10 years ago
caption.php
10 years ago
description.php
10 years ago
dimensions.php
10 years ago
exif-data.php
10 years ago
file-name.php
10 years ago
file-size.php
10 years ago
full-path.php
10 years ago
height.php
10 years ago
mime-type.php
10 years ago
width.php
10 years ago
attached-to.php
44 lines
| 1 | <?php |
| 2 | /** |
| 3 | * CPAC_Column_Attached_To |
| 4 | * |
| 5 | * @since 2.0 |
| 6 | */ |
| 7 | class CPAC_Column_Attached_To extends CPAC_Column { |
| 8 | |
| 9 | /** |
| 10 | * @see CPAC_Column::init() |
| 11 | * @since 2.2.1 |
| 12 | */ |
| 13 | public function init() { |
| 14 | |
| 15 | parent::init(); |
| 16 | |
| 17 | // Properties |
| 18 | $this->properties['type'] = 'column-attached_to'; |
| 19 | $this->properties['label'] = __( 'Attached to post', 'codepress-admin-columns' ); |
| 20 | } |
| 21 | |
| 22 | /** |
| 23 | * @see CPAC_Column::get_value() |
| 24 | * @since 2.0 |
| 25 | */ |
| 26 | public function get_value( $id ) { |
| 27 | $value = false; |
| 28 | if ( $attached_to = $this->get_raw_value() ) { |
| 29 | $value = get_the_title( $attached_to ); |
| 30 | if ( $edit_link = get_edit_post_link( $id ) ) { |
| 31 | $value = '<a href="' . $edit_link . '">' . $value . '</a>'; |
| 32 | } |
| 33 | } |
| 34 | return $value; |
| 35 | } |
| 36 | |
| 37 | /** |
| 38 | * @see CPAC_Column::get_value() |
| 39 | * @since 2.0 |
| 40 | */ |
| 41 | public function get_raw_value( $id ) { |
| 42 | return get_post_field( $id, 'post_parent' ); |
| 43 | } |
| 44 | } |