';
return [
'id' => uniqid(),
'type' => self::$type,
'name' => __( 'Products With Reviews', 'yaymail' ),
'icon' => self::$icon,
'group' => 'block',
'tags' => [ 'woocommerce' ],
'available' => false,
'disabled_reason' => [
'html' => ''
. ''
. self::get_pro_upgrade_text()
. '',
],
'position' => 220,
'status_info' => [
'text' => __( 'New', 'yaymail' ),
],
'data' => [
'padding' => [
'value_path' => 'padding',
'component' => 'Spacing',
'title' => __( 'Padding', 'yaymail' ),
'default_value' => isset( $attributes['padding'] ) ? $attributes['padding'] : [
'top' => '15',
'right' => '50',
'bottom' => '15',
'left' => '50',
],
'type' => 'style',
],
'background_color' => [
'value_path' => 'background_color',
'component' => 'Color',
'title' => __( 'Background color', 'yaymail' ),
'default_value' => isset( $attributes['background_color'] ) ? $attributes['background_color'] : '#fff',
'type' => 'style',
],
'text_color' => [
'value_path' => 'text_color',
'component' => 'Color',
'title' => __( 'Text color', 'yaymail' ),
'default_value' => isset( $attributes['text_color'] ) ? $attributes['text_color'] : YAYMAIL_COLOR_TEXT_DEFAULT,
'type' => 'style',
],
'font_family' => [
'value_path' => 'font_family',
'component' => 'FontFamilySelector',
'title' => __( 'Font family', 'yaymail' ),
'default_value' => isset( $attributes['font_family'] ) ? $attributes['font_family'] : YAYMAIL_DEFAULT_FAMILY,
'type' => 'style',
],
'product_type' => [
'value_path' => 'product_type',
'component' => 'Selector',
'title' => __( 'Type', 'yaymail' ),
'default_value' => isset( $attributes['product_type'] ) ? $attributes['product_type'] : 'featured',
'type' => 'content',
'options' => [
[
'label' => __( 'Order products', 'yaymail' ),
'value' => 'order_products',
],
[
'label' => __( 'Featured', 'yaymail' ),
'value' => 'featured',
],
[
'label' => __( 'Product selections', 'yaymail' ),
'value' => 'product_selections',
],
],
],
'products' => [
'value_path' => 'products',
'component' => 'EntitiesSelector',
'title' => __( 'Select products', 'yaymail' ),
'default_value' => isset( $attributes['products'] ) ? $attributes['products'] : [],
'type' => 'content',
'entity_type' => 'products',
'conditions' => [
[
'value' => 'product_selections',
'attribute' => 'product_type',
],
],
],
'max_reviews_per_product' => [
'value_path' => 'max_reviews_per_product',
'component' => 'NumberInput',
'title' => __( 'Maximum reviews per product', 'yaymail' ),
'default_value' => isset( $attributes['max_reviews_per_product'] ) ? $attributes['max_reviews_per_product'] : '2',
'type' => 'content',
'is_debounce' => true,
'debounce_time' => 400,
],
'reviews_per_row' => [
'value_path' => 'reviews_per_row',
'component' => 'NumberInput',
'title' => __( 'Reviews per row', 'yaymail' ),
'default_value' => isset( $attributes['reviews_per_row'] ) ? $attributes['reviews_per_row'] : '1',
'min' => 1,
'max' => 3,
'type' => 'content',
],
'review_filter' => [
'value_path' => 'review_filter',
'component' => 'Selector',
'title' => __( 'Review filter by', 'yaymail' ),
'default_value' => isset( $attributes['review_filter'] ) ? $attributes['review_filter'] : 'review_filter_by_rating',
'type' => 'content',
'options' => [
[
'label' => __( 'Review filter by rating', 'yaymail' ),
'value' => 'review_filter_by_rating',
],
[
'label' => __( 'Review filter by date', 'yaymail' ),
'value' => 'review_filter_by_date',
],
],
],
'minimum_rating_to_show' => [
'value_path' => 'minimum_rating_to_show',
'component' => 'NumberInput',
'title' => __( 'Minimum rating', 'yaymail' ),
'default_value' => isset( $attributes['minimum_rating_to_show'] ) ? $attributes['minimum_rating_to_show'] : '1',
'type' => 'content',
'min' => 1,
'max' => 5,
'conditions' => [
[
'comparison' => 'contain',
'value' => [ 'review_filter_by_rating' ],
'attribute' => 'review_filter',
],
],
],
'from_date_to_date' => [
'value_path' => 'from_date_to_date',
'component' => 'DatePicker',
'title' => __( 'Review date', 'yaymail' ),
'default_value' => isset( $attributes['from_date_to_date'] ) ? $attributes['from_date_to_date'] : '',
'type' => 'content',
'calendar_type' => 'range',
'conditions' => [
[
'comparison' => 'contain',
'value' => [ 'review_filter_by_date' ],
'attribute' => 'review_filter',
'operator' => 'or',
],
[
'comparison' => 'contain',
'value' => '',
'attribute' => 'review_filter',
'operator' => 'or',
],
],
],
'showing_items' => [
'value_path' => 'showing_items',
'component' => 'CheckboxGroup',
'title' => __( 'Showing items', 'yaymail' ),
'default_value' => isset( $attributes['showing_items'] ) ? $attributes['showing_items'] : [ 'author_avatar', 'author_name', 'review_date', 'rating_stars', 'review_message' ],
'type' => 'content',
'options' => [
[
'label' => __( 'Author avatar', 'yaymail' ),
'value' => 'author_avatar',
],
[
'label' => __( 'Author name', 'yaymail' ),
'value' => 'author_name',
],
[
'label' => __( 'Review date', 'yaymail' ),
'value' => 'review_date',
],
[
'label' => __( 'Rating stars', 'yaymail' ),
'value' => 'rating_stars',
],
[
'label' => __( 'Review message', 'yaymail' ),
'value' => 'review_message',
],
],
],
'sorted_by' => [
'value_path' => 'sorted_by',
'component' => 'Selector',
'title' => __( 'Sort by', 'yaymail' ),
'default_value' => isset( $attributes['sorted_by'] ) ? $attributes['sorted_by'] : 'des_of_rating',
'options' => [
[
'label' => __( 'Descending by rating', 'yaymail' ),
'value' => 'des_of_rating',
],
[
'label' => __( 'Ascending by rating', 'yaymail' ),
'value' => 'asc_of_rating',
],
[
'label' => __( 'Descending by review date', 'yaymail' ),
'value' => 'des_of_review_date',
],
[
'label' => __( 'Ascending by review date', 'yaymail' ),
'value' => 'asc_of_review_date',
],
],
'type' => 'content',
],
],
];
}
}