Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Socials feed #33

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions framework/Admin/Theme_Settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ abstract class Theme_Settings {
*/
protected static $titan_instance;

public static $panel;

/**
* Theme Settings constructor
* init framework hook
Expand Down
115 changes: 115 additions & 0 deletions framework/Page_Builder/v25/Widgets/Socials_Feed_Widget.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
<?php

namespace JustCoded\WP\Framework\Page_Builder\v25\Widgets;

use JustCoded\WP\Framework\Page_Builder\v25\Page_Builder_Widget;
use JustCoded\WP\Framework\Web\View;

/**
* Class SocialsFeedWidget
*/
// Creating the widget
class Socials_Feed_Widget extends Page_Builder_Widget {


/**
* Full slider type template name
*/
const TYPE_FULL = 'socials-feed-full';

/**
* Default slider type template name
*/
const TYPE_DEFAULT = 'socials-feed-default';


/**
* Hero_Slider_Widget constructor.
*/
function __construct() {
parent::__construct(
'socials-feed',
__( 'Socials Feed' ),
array(
'description' => __( 'Socials Feed' ),
'has_preview' => false,
),
array(),
false,
''
);
}


/**
* Form fields configuration
*
* @return array
*/
function get_widget_form() {
return
array(
'social_networks' => array(
'type' => 'section',
'label' => __( 'Choose socials network for show', 'boilerplate' ),
'hide' => true,
'fields' => array(
'facebook' => array(
'type' => 'checkbox',
'label' => __( 'Facebook', 'boilerplate' ),
'default' => false,
),
'twitter' => array(
'type' => 'checkbox',
'label' => __( 'Twitter', 'boilerplate' ),
'default' => false,
),
'instagram' => array(
'type' => 'checkbox',
'label' => __( 'Instagram', 'boilerplate' ),
'default' => false,
),
),
),
'widget_type' => array(
'type' => 'select',
'label' => __( 'Choose widget type', 'boilerplate' ),
'options' => array(
self::TYPE_DEFAULT => __( 'Default', 'boilerplate' ),
self::TYPE_FULL => __( 'Full width', 'boilerplate' ),
),
'default' => 'full',
),
);

}

/**
* Modify form submitted values before save.
*
* @param array $instance submitted form values.
*
* @return array
*/
public function modify_instance( $instance ) {

return $instance;
}

/**
* Print widget method.
*
* @param array $args Widget display arguments.
* @param array $instance Widget settings.
*/
public function widget( $args, $instance ) {
$instance = $this->get_template_variables( $instance, $args );
$template = ( self::TYPE_FULL === $instance['widget_type'] ) ? 'socials-feed-full' : 'socials-feed-default';

View::instance()->include( 'widgets/' . $template, array(
'instance' => $instance,
'before_widget' => $args['before_widget'],
'after_widget' => $args['after_widget'],
) );
}
}
Loading