I have a plugin. In this plugin I did elementtype which extends the user one, but with only one source "clients". I have and New Client button which points to my plugin Plugin_ClientController
which looks like this:
class Plugin_ClientController extends UsersController
{
public function actionIndex( array $variables = array() ) {
$this->renderTemplate('plugin/client/_index');
}
public function renderTemplate($path, array $variables = array()) {
$path = str_replace('users/', 'plugin/client/', $path);
parent::renderTemplate($path, $variables);
}
}
I don't know if this is the right way to do this, but it seems to work, so like this I can have my one view for Client edit, which is almost the same as users one.
My elementtype is look like this:
class Plugin_ClientElementType extends UserElementType
{
public function getSources($context = null)
{
$sources = array(
'*' => array(
'label' => Craft::t('Clients'),
'criteria' => array('groupId' => 1),
'hasThumbs' => true
)
);
return $sources;
}
}
So all fine up to here. The problem is in that list:
where I list all my clients the url on the title in my case now User1
is pointing to admin/users/[ID]
I would like to change it to plugin/client/[ID]
if that possible I know that it has to be in the model like this:
class Pluign_ClientModel extends UserModel
{
protected $elementType = 'Plugin_Client';
public function getCpEditUrl()
{
return UrlHelper::getCpUrl('plugin/client/' . $this->id);
}
}
But it seems that it's not coming from there. If someone can help me with this would be great. Thank you in advance.