array( 'location' => 'header', 'group' => 'theme', 'conditions' => true, 'context' => 'none', 'class' => 'Buildify\\Elementor\\Documents\\Header', 'icon' => 'dashicons-align-wide', ), 'footer' => array( 'location' => 'footer', 'group' => 'theme', 'conditions' => true, 'context' => 'none', 'class' => 'Buildify\\Elementor\\Documents\\Footer', 'icon' => 'dashicons-align-full-width', ), 'single' => array( 'location' => 'content', 'group' => 'theme', 'conditions' => true, 'context' => 'singular', 'class' => 'Buildify\\Elementor\\Documents\\Single', 'icon' => 'dashicons-media-document', ), 'archive' => array( 'location' => 'content', 'group' => 'theme', 'conditions' => true, 'context' => 'archive', 'class' => 'Buildify\\Elementor\\Documents\\Archive', 'icon' => 'dashicons-grid-view', ), 'search' => array( 'location' => 'content', 'group' => 'theme', 'conditions' => false, 'context' => 'archive', 'class' => 'Buildify\\Elementor\\Documents\\Search_Results', 'icon' => 'dashicons-search', ), 'error-404' => array( 'location' => 'content', 'group' => 'theme', 'conditions' => false, 'context' => 'none', 'class' => 'Buildify\\Elementor\\Documents\\Error_404', 'icon' => 'dashicons-warning', ), 'single-product' => array( 'location' => 'content', 'group' => 'woocommerce', 'conditions' => true, 'context' => 'product', 'class' => 'Buildify\\Elementor\\Documents\\Single_Product', 'icon' => 'dashicons-products', ), 'product-archive' => array( 'location' => 'content', 'group' => 'woocommerce', 'conditions' => true, 'context' => 'product_archive', 'class' => 'Buildify\\Elementor\\Documents\\Product_Archive', 'icon' => 'dashicons-store', ), 'section' => array( 'location' => 'none', 'group' => 'section', 'conditions' => false, 'context' => 'none', 'class' => 'Buildify\\Elementor\\Documents\\Section', 'icon' => 'dashicons-layout', ), 'popup' => array( 'location' => 'popup', 'group' => 'popup', 'conditions' => true, 'context' => 'none', 'class' => 'Buildify\\Elementor\\Documents\\Popup', 'icon' => 'dashicons-external', ), ); if ( ! Plugin::is_woocommerce_active() || ! Settings::is_on( 'woocommerce' ) ) { unset( $types['single-product'], $types['product-archive'] ); } if ( ! Settings::is_on( 'popups' ) ) { unset( $types['popup'] ); } if ( ! Settings::is_on( 'theme_builder' ) ) { foreach ( $types as $key => $type ) { if ( in_array( $type['group'], array( 'theme', 'woocommerce' ), true ) ) { unset( $types[ $key ] ); } } } /** * Filters the Buildify template types. * * @param array $types Type definitions. */ return (array) apply_filters( 'buildify_template_types', $types ); } /** * Translated labels. * * @return array */ public static function labels() { return array( 'header' => __( 'Header', 'buildify' ), 'footer' => __( 'Footer', 'buildify' ), 'single' => __( 'Single', 'buildify' ), 'archive' => __( 'Archive', 'buildify' ), 'search' => __( 'Search Results', 'buildify' ), 'error-404' => __( '404 Page', 'buildify' ), 'single-product' => __( 'Single Product', 'buildify' ), 'product-archive' => __( 'Products Archive', 'buildify' ), 'section' => __( 'Section', 'buildify' ), 'popup' => __( 'Popup', 'buildify' ), ); } /** * Short descriptions for the "Add new" screen. * * @return array */ public static function descriptions() { return array( 'header' => __( 'The top of your site: logo, menu, search and cart.', 'buildify' ), 'footer' => __( 'The bottom of your site: widgets, links and copyright.', 'buildify' ), 'single' => __( 'The layout of posts, pages or custom post types.', 'buildify' ), 'archive' => __( 'Blog page, categories, tags, authors and post type archives.', 'buildify' ), 'search' => __( 'The search results page.', 'buildify' ), 'error-404' => __( 'The page visitors see when a URL does not exist.', 'buildify' ), 'single-product' => __( 'The WooCommerce product page.', 'buildify' ), 'product-archive' => __( 'The WooCommerce shop page and product categories.', 'buildify' ), 'section' => __( 'A reusable block you can insert with a widget, block or shortcode.', 'buildify' ), 'popup' => __( 'Modals, slide-ins, bars and full-screen popups with triggers.', 'buildify' ), ); } /** * Label of a type. * * @param string $type Type key. * @return string */ public static function label( $type ) { $labels = self::labels(); return isset( $labels[ $type ] ) ? $labels[ $type ] : $type; } /** * Whether a type exists and is enabled. * * @param string $type Type key. * @return bool */ public static function exists( $type ) { $types = self::definitions(); return isset( $types[ $type ] ); } /** * Definition of one type. * * @param string $type Type key. * @return array|null */ public static function get( $type ) { $types = self::definitions(); return isset( $types[ $type ] ) ? $types[ $type ] : null; } /** * Elementor document type name. * * @param string $type Type key. * @return string */ public static function doc_type( $type ) { return self::DOC_PREFIX . $type; } /** * Buildify type of a template post. * * @param int $post_id Template ID. * @return string Empty string when unknown. */ public static function of( $post_id ) { $type = (string) get_post_meta( $post_id, Post_Type::TYPE_META, true ); return '' !== $type ? $type : ''; } }