-
|
I like Use case: I've created my own base action that will be used in some cases. Sometimes I want to make the action destructive. It would be clean with interface but not as clean without interface. |
Beta Was this translation helpful? Give feedback.
Answered by
crynobone
Apr 11, 2022
Replies: 1 comment 1 reply
-
|
You can just override /**
* Prepare the action for JSON serialization.
*
* @return array<string, mixed>
*/
public function jsonSerialize(): array
{
return array_merge(parent::jsonSerialize(), [
'destructive' => true, // or $this instanceof CustomDescructiveActionInterface
]);
} |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
crynobone
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can just override
jsonSerialize()method: