yii2 get action class in view

To get the action class in a Yii2 view, you can use the $this->context property. This property refers to the current controller, and you can access its action class using the action property. Here's an example of how you can retrieve the action class in a Yii2 view:

$actionClass = $this->context->action->controller->actionParams['class'];

In this example, $actionClass will contain the class name of the action associated with the current view. Make sure to replace actionParams with the appropriate property if you're using a different version of Yii.

Please note that this code assumes that you're accessing the action class from within a view file. If you're trying to access it in a different context, you may need to adjust the code accordingly.

I hope this helps! Let me know if you have any further questions.