After trying every possible way I could imagine I finally found the solution and I've been pretty close with the version I mentioned in this post.
class BookstoreRouter extends JComponentRouterView
public function __construct($app = null, $menu = null)
$books = new JComponentRouterViewconfiguration('books');
I won't pretend to believe that this answer will completely resolve your problem, but I do see a couple things to be fixed up.
if (!strpos($id, ':')) is not advisable practice even if it does what you intend to do. To check if a substring exists within a string you should be performing a strict boolean check on false (either !== or ===)
if (strpos($id, ':'...
Create a installer script for your component (com_your_component_name/script.php) and add the following code:
defined('_JEXEC') or die;
The installer script file allows you to run code when your component is installed, uninstalled, ...
I would suggest you look at creating a plugin to send the email that responds to a onContentChangeState event trigger. The plugin would check that it is an item of your component being changed($context in the params) and then it will provide the ID and the value(Published/Unplublished) that you can use in your email subject or body.
This should be a ...