first commit
This commit is contained in:
@@ -0,0 +1,86 @@
|
||||
<?php if ( ! defined( 'ABSPATH' ) ) {
|
||||
die();
|
||||
}
|
||||
if ( ( defined( 'FW' ) ) && ! ( class_exists( 'Solarify_Widget_About' ) ) ) :
|
||||
|
||||
class Solarify_Widget_About extends WP_Widget {
|
||||
|
||||
/**
|
||||
* Widget constructor.
|
||||
*/
|
||||
private $options;
|
||||
private $prefix;
|
||||
|
||||
function __construct() {
|
||||
|
||||
$widget_ops = array(
|
||||
'classname' => 'widget_about',
|
||||
'description' => esc_html__( 'Add company logo with description and social icons', 'solarify' ),
|
||||
);
|
||||
|
||||
parent::__construct( false, esc_html__( 'Theme - About', 'solarify' ), $widget_ops );
|
||||
|
||||
//Create our options by using Unyson option types
|
||||
$this->options = array(
|
||||
'title' => array(
|
||||
'type' => 'text',
|
||||
'label' => esc_html__( 'Widget Title', 'solarify' ),
|
||||
),
|
||||
'about' => array(
|
||||
'type' => 'wp-editor',
|
||||
'value' => '',
|
||||
'label' => esc_html__('Description', 'solarify'),
|
||||
),
|
||||
);
|
||||
$this->prefix = 'widget_about';
|
||||
}
|
||||
|
||||
function widget( $args, $instance ) {
|
||||
extract( wp_parse_args( $args ) );
|
||||
|
||||
$title = esc_attr( $instance['title'] );
|
||||
$title = $before_title . $title . $after_title;
|
||||
|
||||
$params = array();
|
||||
|
||||
foreach ( $instance as $key => $value ) {
|
||||
$params[ $key ] = $value;
|
||||
}
|
||||
|
||||
$instance = $params;
|
||||
|
||||
$filepath = SOLARIFY_THEME_PATH . '/inc/widgets/about/views/widget.php';
|
||||
|
||||
if ( file_exists( $filepath ) ) {
|
||||
include( $filepath );
|
||||
} else {
|
||||
esc_html_e( 'View not found', 'solarify' );
|
||||
}
|
||||
}
|
||||
|
||||
function update( $new_instance, $old_instance ) {
|
||||
return fw_get_options_values_from_input(
|
||||
$this->options,
|
||||
FW_Request::POST( fw_html_attr_name_to_array_multi_key( $this->get_field_name( $this->prefix ) ), array() )
|
||||
);
|
||||
}
|
||||
|
||||
function form( $values ) {
|
||||
|
||||
$prefix = $this->get_field_id( $this->prefix ); // Get unique prefix, preventing duplicated key
|
||||
$id = 'fw-widget-options-' . $prefix;
|
||||
|
||||
// Print our options
|
||||
echo '<div class="fw-force-xs fw-theme-admin-widget-wrap fw-framework-widget-options-widget" data-fw-widget-id="' . esc_attr( $id ) . '" id="' . esc_attr( $id ) . '">';
|
||||
|
||||
echo fw()->backend->render_options( $this->options, $values, array(
|
||||
'id_prefix' => $prefix . '-',
|
||||
'name_prefix' => $this->get_field_name( $this->prefix ),
|
||||
) );
|
||||
echo '</div>';
|
||||
|
||||
return $values;
|
||||
}
|
||||
}
|
||||
|
||||
endif;
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php if ( ! defined( 'ABSPATH' ) ) {
|
||||
die();
|
||||
}
|
||||
if ( ! defined( 'FW' ) ) {
|
||||
return;
|
||||
}
|
||||
/**
|
||||
* @var string $before_widget
|
||||
* @var string $after_widget
|
||||
* @var array $params
|
||||
*/
|
||||
$footer_variant = fw_get_db_customizer_option( 'footer' );
|
||||
$logo_image_variant = ( $footer_variant === '2' ) ? 'logo_image_light' : 'logo_image';
|
||||
$unique_id = uniqid();
|
||||
$logo_image = ( function_exists( 'fw_get_db_settings_option' ) ) ? fw_get_db_customizer_option( $logo_image_variant ) : '';
|
||||
|
||||
$logo_text = ( function_exists( 'fw_get_db_settings_option' ) ) ? fw_get_db_customizer_option( 'logo_text' ) : get_option( 'blogname' );
|
||||
|
||||
echo wp_kses_post( $before_widget );
|
||||
|
||||
if ( $logo_image ) : ?>
|
||||
<div class="footer_logo">
|
||||
<img src="<?php echo esc_attr( $logo_image['url'] ); ?>"
|
||||
alt="<?php echo esc_attr( $logo_text ); ?>">
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<div class="logo">
|
||||
<span class="logo_text">
|
||||
<?php echo esc_html( $logo_text ); ?>
|
||||
</span class="logo_text">
|
||||
</div>
|
||||
<?php endif;
|
||||
|
||||
if ( !empty( $params['title'] ) ) {
|
||||
echo wp_kses_post( $title );
|
||||
}
|
||||
|
||||
|
||||
if ( $params['about'] ) { ?>
|
||||
|
||||
<div class="divider_20">
|
||||
<?php echo wp_kses_post( $params['about'] ); ?>
|
||||
</div>
|
||||
|
||||
<?php }
|
||||
|
||||
echo wp_kses_post( $after_widget );
|
||||
Reference in New Issue
Block a user