示例#1
0
文件: Filter.php 项目: aiesh/magento2
 /**
  * Generate widget HTML if template variables are assigned
  *
  * @param string[] $construction
  * @return string
  */
 public function widgetDirective($construction)
 {
     if (!isset($this->_templateVars['subscriber'])) {
         return $construction[0];
     }
     $construction[2] .= sprintf(' store_id ="%s"', $this->getStoreId());
     return parent::widgetDirective($construction);
 }
 /**
  * @param array $construction
  * @param string $name
  * @param string $type
  * @param int $preConfigId
  * @param array $params
  * @param array $preconfigure
  * @param string $widgetXml
  * @param \Magento\Widget\Block\BlockInterface|null $widgetBlock
  * @param string $expectedResult
  * @return void
  * @dataProvider generateWidgetDataProvider
  */
 public function testWidgetDirective($construction, $name, $type, $preConfigId, $params, $preconfigure, $widgetXml, $widgetBlock, $expectedResult)
 {
     $this->generalForGenerateWidget($name, $type, $preConfigId, $params, $preconfigure, $widgetXml, $widgetBlock);
     $this->assertSame($expectedResult, $this->filter->widgetDirective($construction));
 }