%PDF- %PDF-
| Direktori : /home/opti/public_html/stlc/wp-content/plugins/insur-addon/includes/Metaboxes/ |
| Current File : /home/opti/public_html/stlc/wp-content/plugins/insur-addon/includes/Metaboxes/Portfolio.php |
<?php
namespace Layerdrops\Insur\Metaboxes;
class Portfolio
{
function __construct()
{
add_action('cmb2_admin_init', [$this, 'add_metabox']);
}
function add_metabox()
{
$prefix = 'insur_';
$general = new_cmb2_box(array(
'id' => $prefix . 'portfolio_option',
'title' => __('Portfolio Options', 'insur-addon'),
'object_types' => array('portfolio'),
'context' => 'normal',
'priority' => 'default',
));
$general->add_field(array(
'name' => __('Client Name', 'insur-addon'),
'id' => $prefix . 'portfolio_client',
'type' => 'text',
));
$general->add_field(array(
'name' => __('Complete Date', 'insur-addon'),
'id' => $prefix . 'portfolio_date',
'type' => 'text',
));
$general->add_field(array(
'name' => __('Preview Link', 'insur-addon'),
'id' => $prefix . 'portfolio_preview_link',
'type' => 'text',
'attributes' => array(
'data-conditional-id' => $prefix . 'portfolio_single_layout',
'data-conditional-value' => 'layout_three',
),
));
$general->add_field(array(
'name' => __('Enable Custom Footer', 'insur-addon'),
'id' => $prefix . 'custom_footer_status',
'type' => 'radio',
'options' => array(
'on' => __('On', 'insur-addon'),
'off' => __('Off', 'insur-addon'),
),
));
$general->add_field(array(
'name' => __('Select Custom Footer', 'insur-addon'),
'id' => $prefix . 'select_custom_footer',
'type' => 'pw_select',
'options' => insur_post_query('footer'),
'attributes' => array(
'data-conditional-id' => $prefix . 'custom_footer_status',
'data-conditional-value' => 'on',
),
));
$general->add_field(array(
'name' => __('Show Page Banner', 'insur-addon'),
'id' => $prefix . 'show_page_banner',
'type' => 'radio',
'default' => 'on',
'options' => array(
'on' => __('On', 'insur-addon'),
'off' => __('Off', 'insur-addon'),
),
));
$general->add_field(array(
'name' => __('Enable BreadCrumb', 'insur-addon'),
'id' => $prefix . 'show_page_breadcrumb',
'type' => 'radio',
'default' => 'on',
'options' => array(
'on' => __('On', 'insur-addon'),
'off' => __('Off', 'insur-addon'),
),
'attributes' => array(
'data-conditional-id' => $prefix . 'show_page_banner',
'data-conditional-value' => 'on',
),
));
$general->add_field(array(
'name' => __('Header Title', 'insur-addon'),
'id' => $prefix . 'set_header_title',
'type' => 'text',
'attributes' => array(
'data-conditional-id' => $prefix . 'show_page_banner',
'data-conditional-value' => 'on',
),
));
$general->add_field(array(
'name' => __('Header Image', 'insur-addon'),
'id' => $prefix . 'set_header_image',
'type' => 'file',
'attributes' => array(
'data-conditional-id' => $prefix . 'show_page_banner',
'data-conditional-value' => 'on',
),
));
//feature box
$feature_box = new_cmb2_box(array(
'id' => $prefix . 'portfolio_feature_box_option',
'title' => __('Feature Box', 'insur-addon'),
'object_types' => array('portfolio'),
'context' => 'normal',
'priority' => 'default',
));
$portfolio_feature_box = $feature_box->add_field(array(
'id' => $prefix . 'portfolio_feature_box',
'type' => 'group',
'options' => array(
'group_title' => esc_html__('Feature Box {#}', 'insur-addon'), // {#} gets replaced by row number
'add_button' => esc_html__('Add Another Feature Box Item', 'insur-addon'),
'remove_button' => esc_html__('Remove Feature Box Item', 'insur-addon'),
'sortable' => false,
'closed' => true, // true to have the groups closed by default
// 'remove_confirm' => esc_html__( 'Are you sure you want to remove?', 'insur-addon' ), // Performs confirmation before removing group.
),
));
$feature_box->add_group_field($portfolio_feature_box, array(
'name' => __('Feature Box Icon', 'insur-addon'),
'id' => $prefix . 'feature_box_icon',
'type' => 'pw_select',
'default' => 'fa-twitter',
'options' => insur_get_fa_icons(),
));
$feature_box->add_group_field($portfolio_feature_box, array(
'name' => __('Is FontAwesome Icon?', 'insur-addon'),
'id' => $prefix . 'feature_is_fontawesome',
'type' => 'radio',
'show_option_none' => false,
'options' => array(
'yes' => __('Yes', 'insur-addon'),
'no' => __('No', 'insur-addon'),
),
'default' => 'yes'
));
$feature_box->add_group_field($portfolio_feature_box, array(
'name' => __('Type of FontAwesome?', 'insur-addon'),
'id' => $prefix . 'feature_fontawesome_type',
'type' => 'radio',
'show_option_none' => false,
'options' => array(
'fas' => __('Solid', 'insur-addon'),
'far' => __('Regular', 'insur-addon'),
'fal' => __('Light', 'insur-addon'),
'fab' => __('Brands', 'insur-addon'),
),
'attributes' => array(
'data-conditional-id' => wp_json_encode(array($portfolio_feature_box, 'insur_feature_is_fontawesome')),
'data-conditional-value' => 'yes',
),
));
$feature_box->add_group_field($portfolio_feature_box, array(
'name' => __('Feature Box Title', 'insur-addon'),
'id' => $prefix . 'feature_box_title',
'type' => 'text',
));
$feature_box->add_group_field($portfolio_feature_box, array(
'name' => __('Feature Box Content', 'insur-addon'),
'id' => $prefix . 'feature_box_content',
'type' => 'textarea',
));
//social network
$social_network = new_cmb2_box(array(
'id' => $prefix . 'portfolio_social_network_option',
'title' => __('Social Network', 'insur-addon'),
'object_types' => array('portfolio'),
'context' => 'normal',
'priority' => 'default',
));
$portfolio_social_network = $social_network->add_field(array(
'id' => $prefix . 'portfolio_social_network',
'type' => 'group',
'options' => array(
'group_title' => esc_html__('Social Network {#}', 'insur-addon'), // {#} gets replaced by row number
'add_button' => esc_html__('Add Another Social Network Item', 'insur-addon'),
'remove_button' => esc_html__('Remove Social Network Item', 'insur-addon'),
'sortable' => false,
'closed' => true, // true to have the groups closed by default
// 'remove_confirm' => esc_html__( 'Are you sure you want to remove?', 'insur-addon' ), // Performs confirmation before removing group.
),
));
$social_network->add_group_field($portfolio_social_network, array(
'name' => __('Social Network Icon', 'insur-addon'),
'id' => $prefix . 'social_network_icon',
'type' => 'pw_select',
'default' => 'icon-increment',
'options' => insur_get_fa_icons(),
));
$social_network->add_group_field($portfolio_social_network, array(
'name' => __('Is FontAwesome Icon?', 'insur-addon'),
'id' => $prefix . 'social_network_is_fontawesome',
'type' => 'radio',
'show_option_none' => false,
'options' => array(
'yes' => __('Yes', 'insur-addon'),
'no' => __('No', 'insur-addon'),
),
));
$social_network->add_group_field($portfolio_social_network, array(
'name' => __('Type of FontAwesome?', 'insur-addon'),
'id' => $prefix . 'social_network_fontawesome_type',
'type' => 'radio',
'show_option_none' => false,
'options' => array(
'fas' => __('Solid', 'insur-addon'),
'far' => __('Regular', 'insur-addon'),
'fal' => __('Light', 'insur-addon'),
'fab' => __('Brands', 'insur-addon'),
),
'attributes' => array(
'data-conditional-id' => wp_json_encode(array($portfolio_social_network, 'insur_social_network_is_fontawesome')),
'data-conditional-value' => 'yes',
),
));
$social_network->add_group_field($portfolio_social_network, array(
'name' => __('Social Network Url', 'insur-addon'),
'id' => $prefix . 'social_network_url',
'type' => 'text',
'default' => '#'
));
}
}