Upgarded to 4.17.4
This commit is contained in:
71
includes/builder/post/taxonomy/LayoutTag.php
Normal file
71
includes/builder/post/taxonomy/LayoutTag.php
Normal file
@ -0,0 +1,71 @@
|
||||
<?php
|
||||
/**
|
||||
* Init layout_tag taxonomy.
|
||||
*
|
||||
* @package Builder
|
||||
*/
|
||||
|
||||
/**
|
||||
* Class to init layout_tag taxonomy.
|
||||
*/
|
||||
class ET_Builder_Post_Taxonomy_LayoutTag extends ET_Core_Post_Taxonomy {
|
||||
|
||||
/**
|
||||
* Owner name.
|
||||
*
|
||||
* @since 4.17.0
|
||||
* @var string
|
||||
*/
|
||||
protected $_owner = 'builder';
|
||||
|
||||
/**
|
||||
* Taxonomy key.
|
||||
*
|
||||
* @since 4.17.0
|
||||
* @var string
|
||||
*/
|
||||
public $name = 'layout_tag';
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function _get_args() {
|
||||
return array(
|
||||
'hierarchical' => false,
|
||||
'show_ui' => true,
|
||||
'show_admin_column' => true,
|
||||
'query_var' => true,
|
||||
'show_in_nav_menus' => false,
|
||||
'publicly_queryable' => ET_Builder_Post_Type_Layout::is_publicly_queryable(),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
protected function _get_labels() {
|
||||
return array(
|
||||
'name' => esc_html__( 'Tags', 'et_builder' ),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the class instance.
|
||||
*
|
||||
* @since 3.0.99
|
||||
*
|
||||
* @param string $type See {@see self::$wp_type} for accepted values. Default is 'taxonomy'.
|
||||
* @param string $name The name/slug of the post object. Default is {@see self::$name}.
|
||||
*
|
||||
* @return self|null
|
||||
*/
|
||||
public static function instance( $type = 'taxonomy', $name = 'layout_tag' ) {
|
||||
$instance = parent::instance( $type, $name );
|
||||
|
||||
if ( ! $instance ) {
|
||||
$instance = new self();
|
||||
}
|
||||
|
||||
return $instance;
|
||||
}
|
||||
}
|
@ -82,10 +82,12 @@ class ET_Builder_Post_Type_Layout extends ET_Core_Post_Type {
|
||||
),
|
||||
'taxonomies' => array(
|
||||
'layout_category',
|
||||
'layout_tag',
|
||||
'layout_pack',
|
||||
'layout_type',
|
||||
'module_width',
|
||||
'scope',
|
||||
'layout_location',
|
||||
),
|
||||
);
|
||||
}
|
||||
@ -149,6 +151,17 @@ class ET_Builder_Post_Type_Layout extends ET_Core_Post_Type {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether or not a layout is Favorite.
|
||||
*
|
||||
* @param string $post_id Post ID.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function is_favorite( $post_id ) {
|
||||
return 'favorite' === get_post_meta( $post_id, 'favorite_status', true );
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if the Library's CPT and taxonomies should be publicly queryable for the current request.
|
||||
*
|
||||
|
Reference in New Issue
Block a user