Skip to content

Commit

Permalink
Merge pull request #5 from rymedia/dev-ry
Browse files Browse the repository at this point in the history
Customization option
  • Loading branch information
bluezed authored Jul 19, 2020
2 parents 0164d15 + 6c737d1 commit 4de4262
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@ Add this line to your main layout so the widget gets loaded automatically into e
<?= \bluezed\scrollTop\ScrollTop::widget() ?>
```

To customize the class of the i and a-tags generated by the widget use the following syntax:
```php
<?= \bluezed\scrollTop\ScrollTop::widget([
'i_class' => 'glyphicon glyphicon-menu-up bluezed-scroll-top-circle my_custom_class',
'a_class' => 'bluezed-scroll-top my_other_custom_class') ?>
```


By default your main layout should be located here:
```
<Project-Folder>/views/layouts/main.php
Expand Down
16 changes: 13 additions & 3 deletions ScrollTop.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,21 @@
*/
class ScrollTop extends Widget
{
public $i_class;
public $a_class;

/**
* @inheritdoc
*/
public function init()
{
if($this->i_class === null){
$this->i_class = 'glyphicon glyphicon-menu-up bluezed-scroll-top-circle';
}
if($this->a_class === null){
$this->a_class = 'bluezed-scroll-top';
}

$view = $this->getView();
ScrollTopAsset::register($view);
}
Expand All @@ -35,10 +45,10 @@ public function run()
Html::tag(
'i',
'',
['class'=>'glyphicon glyphicon-menu-up bluezed-scroll-top-circle']
['class'=> $this->i_class]
),
'#',
['id'=>'btn-top-scroller', 'class'=>'bluezed-scroll-top']
['id'=>'btn-top-scroller', 'class'=> $this->a_class]
);
}
}
}

0 comments on commit 4de4262

Please sign in to comment.