| 1 |
<?php |
| 2 |
namespace Elementor\Modules\Library\Traits; |
| 3 |
|
| 4 |
use Elementor\TemplateLibrary\Source_Local; |
| 5 |
|
| 6 |
/** |
| 7 |
* Elementor Library Trait |
| 8 |
* |
| 9 |
* This trait is used by all Library Documents and Landing Pages. |
| 10 |
* |
| 11 |
* @since 3.1.0 |
| 12 |
*/ |
| 13 |
trait Library { |
| 14 |
/** |
| 15 |
* Print Admin Column Type |
| 16 |
* |
| 17 |
* Runs on WordPress' 'manage_{custom post type}_posts_custom_column' hook to modify each row's content. |
| 18 |
* |
| 19 |
* @since 3.1.0 |
| 20 |
* @access public |
| 21 |
*/ |
| 22 |
public function print_admin_column_type() { |
| 23 |
$admin_filter_url = admin_url( Source_Local::ADMIN_MENU_SLUG . '&elementor_library_type=' . $this->get_name() ); |
| 24 |
// PHPCS - Not a user input |
| 25 |
printf( '<a href="%s">%s</a>', $admin_filter_url, $this->get_title() ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 26 |
} |
| 27 |
|
| 28 |
/** |
| 29 |
* Save document type. |
| 30 |
* |
| 31 |
* Set new/updated document type. |
| 32 |
* |
| 33 |
* @since 3.1.0 |
| 34 |
* @access public |
| 35 |
*/ |
| 36 |
public function save_template_type() { |
| 37 |
parent::save_template_type(); |
| 38 |
|
| 39 |
wp_set_object_terms( $this->post->ID, $this->get_name(), Source_Local::TAXONOMY_TYPE_SLUG ); |
| 40 |
} |
| 41 |
} |
| 42 |
|