How to create buttontransfer entity while using CustomerTableActionExpanderPluginInterface?
Hi team!
I am working on spryker plugin where I am using CustomerTableActionExpanderPluginInterface
to adding the button in table view into the backoffice,
public function execute(int $idCustomer, array $buttonTransfers): array{
// hre the buttontransfer getting expanded into the Communication/Table/SomeTable::class
// But I am not able to define the button entity.
return $buttonTransfers;
}
all are going fine, but there is only one issue;
Not able to define the button value.
Please help me.
Thanks!
Best Answers
-
- Hi @jsinha,
I'm not sure what you exactly mean by the button value, I guess you probably mean the URL used whenever the user clicks on the button. If that is the case it may look something like this.
use Generated\Shared\Transfer\ButtonTransfer;
use Spryker\Service\UtilText\Model\Url\Url;
public function execute(int $idCustomer, array $buttonTransfers): array
{
// first generate the URL $url = Url::generate( 'your-url/perform-some-action', [ // any additional parameter e.g. customerId 'customer-id' => $idCustomer, ], ); $buttons[] = (new ButtonTransfer()) ->setUrl($url) ->setTitle('Your button tittle') ->setDefaultOptions([
// 'class' => 'here you can add any CSS class', // 'icon' => 'you can also define some icon',
]); return $buttonTransfers; }I hope this helps you find the specific solution you want.
Let me know whether this helped, otherwise, maybe you can add some additional information about your specific use case so I can guide you. Cheers 😉1 - Hi @jsinha,
-
Hi @amansilla
Thank you very much !!0
Answers
-
- Hi @jsinha,
I'm not sure what you exactly mean by the button value, I guess you probably mean the URL used whenever the user clicks on the button. If that is the case it may look something like this.
use Generated\Shared\Transfer\ButtonTransfer;
use Spryker\Service\UtilText\Model\Url\Url;
public function execute(int $idCustomer, array $buttonTransfers): array
{
// first generate the URL $url = Url::generate( 'your-url/perform-some-action', [ // any additional parameter e.g. customerId 'customer-id' => $idCustomer, ], ); $buttons[] = (new ButtonTransfer()) ->setUrl($url) ->setTitle('Your button tittle') ->setDefaultOptions([
// 'class' => 'here you can add any CSS class', // 'icon' => 'you can also define some icon',
]); return $buttonTransfers; }I hope this helps you find the specific solution you want.
Let me know whether this helped, otherwise, maybe you can add some additional information about your specific use case so I can guide you. Cheers 😉1 - Hi @jsinha,
-
Hi @amansilla
Thank you very much !!0
Categories
- All Categories
- 42 Getting Started & Guidelines
- 7 Getting Started in the Community
- 8 Additional Resources
- 7 Community Ideas and Feedback
- 68 Spryker News
- 890 Developer Corner
- 753 Spryker Development
- 83 Spryker Dev Environment
- 360 Spryker Releases
- 3 Oryx frontend framework
- 34 Propel ORM
- 68 Community Projects
- 3 Community Ideation Board
- 30 Hackathon
- 3 PHP Bridge
- 6 Gacela Project
- 22 Job Opportunities
- 3.2K 📜 Slack Archives
- 116 Academy
- 5 Business Users
- 370 Docker
- 551 Slack General
- 2K Help
- 75 Knowledge Sharing
- 6 Random Stuff
- 4 Code Testing
- 32 Product & Business Questions
- 68 Spryker Safari Questions
- 50 Random