I am using the Rainlab User plugin module, how do I extend the view part? My first question is, I want to add one more field to the preview scoreboard where I will insert data. My second issue is, with the following code, I can remove the avatar field from the user plugin, but the sidebar still remains. Do I need to remove it with CSS or is there a code for it?
$form->removeField('avatar');
.flex-shrink-0.form-sidebar.control-scrollpanel {
display: none;
}
To extend the view of a controller;
public function boot() {
$this->extendRainlabUserController();
}
public function extendRainlabUserController() {
\Rainlab\User\Controllers\Users::extend(function($controller) {
if (!$controller instanceof \Rainlab\User\Controllers\Users) {
return;
}
list($author, $plugin) = explode('\\', strtolower(get_class()));
$partialsPath = sprintf('$/%s/%s/partials/users', $author, $plugin);
$controller->addViewPath($partialsPath);
});
}
And you can copy the _preview_scoreboard.htm into your custom folder (author/plugin/partials/users/{here}) and modify it as you want.
For the second question, it’s related to the first one I think. Take a look into the original view files and see if you can remove what you don’t want ? Ex:
<?php Block::put('form-sidebar') ?>
<div class="hide-tabs"><?= $this->formRenderSecondaryTabs() ?></div>
<?php Block::endPut() ?>
2 Likes
thank you very much it worked