I’m not sure of there’s an option for visibility there. You can always prepare the attributes array first, different for different roles, and then use it inside FormGrid.
You should use proper IDE and learn how to use Xdebug to dig in the framework code. Without those tools you can not create something more advanced as a blog. Keep in mind that Yii have best comments in a framework core among all other frameworks, and the code is rather simple if we compare with Symfony and Laravel. So you should use the code of the framework as a main documentation.
how can I do that? What I’m doing that is checking on my model the role but than it still show an empty input text if it’s not the admin. I want to completely remove the text input when it’s not admin.
if (Yii::$app->user->can('administrator')) {
$rows = [
[
'attributes' => [
// all the rows and attributes for administrators
]
],
];
} else {
$rows = [
[
'attributes' => [
// all the rows and attributes for non-administrators
]
],
];
}