Skip to content

Commit

Permalink
widget refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
gechetspr committed Sep 26, 2018
1 parent 4db08bb commit ccec9de
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 37 deletions.
4 changes: 1 addition & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,9 @@
},
"require-dev": {
"spryker/code-sniffer": "*",
"spryker/testify": "*",
"spryker-shop/shop-application": "^1.1.1"
"spryker/testify": "*"
},
"suggest": {
"spryker-shop/shop-application": "Use this module when using plugins that need ShopApplication dependencies."
},
"autoload": {
"psr-4": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
} %}

{% block body %}
{% include molecule('search-tabs', 'TabsWidget') with {
class: 'grid',
data: {
tabs: data.tabs,
searchString: data.searchString,
requestParams: data.requestParams
}
} only %}
{% include molecule('search-tabs', 'TabsWidget') with {
class: 'grid',
data: {
tabs: data.tabs,
searchString: data.searchString,
requestParams: data.requestParams
}
} only %}
{% endblock %}
Original file line number Diff line number Diff line change
Expand Up @@ -5,55 +5,45 @@
* Use of this software requires acceptance of the Evaluation License Agreement. See LICENSE file.
*/

namespace SprykerShop\Yves\TabsWidget\Plugin\ShopApplication;
namespace SprykerShop\Yves\TabsWidget\Widget;

use Generated\Shared\Transfer\FullTextSearchTabTransfer;
use Generated\Shared\Transfer\TabMetaDataTransfer;
use Spryker\Yves\Kernel\Widget\AbstractWidgetPlugin;
use SprykerShop\Yves\ShopApplication\Dependency\Plugin\TabsWidget\FullTextSearchTabsWidgetPluginInterface;
use Spryker\Yves\Kernel\Widget\AbstractWidget;
use SprykerShop\Yves\TabsWidgetExtension\Plugin\FullTextSearchTabPluginInterface;

/**
* @method \SprykerShop\Yves\TabsWidget\TabsWidgetFactory getFactory()
*/
class FullTextSearchTabsWidgetPlugin extends AbstractWidgetPlugin implements FullTextSearchTabsWidgetPluginInterface
class FullTextSearchTabsWidget extends AbstractWidget
{
/**
* {@inheritdoc}
*
* @api
*
* @return string
* @param string $searchString
* @param string $activeTabName
* @param array $requestParams
*/
public static function getName(): string
public function __construct(string $searchString, string $activeTabName, array $requestParams = [])
{
return static::NAME;
$this
->addParameter('tabs', $this->getTabs($searchString, $activeTabName, $requestParams))
->addParameter('searchString', $searchString)
->addParameter('requestParams', $requestParams);
}

/**
* {@inheritdoc}
*
* @api
*
* @return string
*/
public static function getTemplate(): string
public static function getName(): string
{
return '@TabsWidget/views/tabs/tabs.twig';
return 'FullTextSearchTabsWidget';
}

/**
* @param string $searchString
* @param string $activeTabName
* @param array $requestParams
*
* @return void
* @return string
*/
public function initialize(string $searchString, string $activeTabName, array $requestParams = []): void
public static function getTemplate(): string
{
$this->addParameter('tabs', $this->getTabs($searchString, $activeTabName, $requestParams))
->addParameter('searchString', $searchString)
->addParameter('requestParams', $requestParams);
return '@TabsWidget/views/tabs/tabs.twig';
}

/**
Expand Down

0 comments on commit ccec9de

Please sign in to comment.