forked from Kreyu/data-table-bundle
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Kreyu#88 Create the DropdownActionType
- Loading branch information
1 parent
29c330c
commit 080bf6c
Showing
5 changed files
with
70 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import {Controller} from '@hotwired/stimulus' | ||
|
||
export default class extends Controller { | ||
static values = { | ||
toggledClass: { type: String, default: 'show' }, | ||
} | ||
|
||
static targets = [ | ||
'content', | ||
]; | ||
|
||
toggle() { | ||
this.contentTarget.classList.toggle(this.toggledClassValue) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace Kreyu\Bundle\DataTableBundle\Action\Type; | ||
|
||
use Kreyu\Bundle\DataTableBundle\Action\ActionInterface; | ||
use Kreyu\Bundle\DataTableBundle\Action\ActionView; | ||
use Symfony\Component\OptionsResolver\OptionsResolver; | ||
|
||
class DropdownActionType extends AbstractActionType | ||
{ | ||
public function buildView(ActionView $view, ActionInterface $action, array $options): void | ||
{ | ||
$view->vars['actions'] = $options['actions']; | ||
} | ||
|
||
public function configureOptions(OptionsResolver $resolver): void | ||
{ | ||
$resolver->define('actions') | ||
->allowedTypes('array') | ||
->required() | ||
; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters