Current code works but it is not an api way. After 2 hours of research i gave up finding an api way.
Use drupals api correctly.
Active
1.1
Code