Задать вопрос

Ошибка Unknown Property – yii\base\UnknownPropertyException Getting unknown property: frontend\widgets\Share::missbutton?

share.php:

namespace frontend\widgets;
use yii\helpers\Html;

class Share extends ShareWidget {

    public function run() {
        echo Html::beginTag($this->tag , $this->htmlOptions);

		echo str_replace(
			'{button}',
			Html::a(
			'<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
	 viewBox="0 0 21.9 15.6" enable-background="new 0 0 21.9 15.6" xml:space="preserve" width="21.9" height="20">

</svg>',
			['/site/share-full', 'url' => urlencode($this->url)],
			[
				//'class' => 'pull-left'
				'onClick' => 'return createModal(this, modalLoadAjax);'
			]
		),
			$this->template
		);

		echo str_replace(
			'{button}',
			Html::a(
			'<svg version="1.1" id="Слой_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
	 viewBox="0 0 13.1 13.1" enable-background="new 0 0 13.1 13.1" xml:space="preserve" width="20" height="20">

</svg>',
			['/site/share', 'url' => urlencode($this->url)],
			[
				'class' => 'visible-sm-block visible-xs-block',
				'onClick' => 'return shareWhatsApp(this);'
			]
		),
			$this->template
		);
             foreach ($this->networks as $key => $val) {
            echo $this->parseTemplate($key);
        }
   echo Html::endTag($this->tag);
   }
}



ShareWidget.php
namespace frontend\widgets;

use yii\helpers\Url;
use frontend\models\SocialIcons;

class ShareWidget extends \bigpaulie\social\share\Widget {
// public $missbutton;
    protected $networks = [
        //'google-plus' => 'https://plus.google.com/share?url={url}',
        'pinterest' => 'https://pinterest.com/pin/create/button/?url={url}',
        'twitter' => 'https://twitter.com/home?status={url}',
        //'linkedin' => 'https://www.linkedin.com/shareArticle?mini=true&url={url}',
        'facebook' => 'https://www.facebook.com/sharer/sharer.php?u={url}',
    ];

	/*protected $colors = [
        'facebook' => '#3b5998',
		'google-plus' => '#dd4b39',
        'pinterest' => '#cb2027',
        'twitter' => '#55acee',
        'linkedin' => '#007bb6',
	];*/
	protected $colors = [
        'facebook' => '#9c9c9c',
		'google-plus' => '#9c9c9c',
        'pinterest' => '#9c9c9c',
        'twitter' => '#9c9c9c',
        'linkedin' => '#9c9c9c',
	];

    protected function parseTemplate($network) {



        if (in_array($network,$this->missbutton)) {
            return false;
        }

        $class = $network;
		$color = $this->colors[$network];

        if ($this->type == 'small') {
            $url = $this->networks[$network];
            $button = str_replace('{button}', '<a href="javascript:;" class="" onClick="sharePopup(\'' . $url . '\');">'
                    . '{network}</a>', $this->template);
            $button = str_replace('{network}', SocialIcons::getIcon($network, $color, 18, 18), $button);
            $button = str_replace('{class}', $class, $button);
            $button = str_replace('{url}', urlencode($this->url), $button);
            return $button;
        } elseif ($this->type == 'large') {
            $url = $this->networks[$network];
            $button = str_replace('{button}', '<a href="javascript:;" class="" onClick="sharePopup(\'' . $url . '\');">'
                    . '{network} {text}</a>', $this->template);
            $button = str_replace('{text}', $this->text, $button);
            $button = str_replace('{network}', SocialIcons::getIcon($network, $color, 30, 30), $button);
            $button = str_replace('{class}', $class, $button);
            $button = str_replace('{url}', urlencode($this->url), $button);
            return $button;
        }
    }

	public function init() {

        if (!$this->id) {
            $this->id = $this->getId();
        }

        if(!isset($this->htmlOptions['id'])){
            $this->htmlOptions['id'] = $this->id;
        }

        if (!$this->url) {
            $this->url = Url::to('', TRUE);
        }
    }
}


5d2489fa30bc3681293658.png
  • Вопрос задан
  • 136 просмотров
Подписаться 1 Простой 21 комментарий
Пригласить эксперта
Ответы на вопрос 1
@konst2018 Автор вопроса
мои скрины для удобства
5d24917409988493293934.png
5d24918b13d36509076520.png
Ответ написан
Комментировать
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы