Using an include file from a different module
Pregunta
I've got a module that I've created just for the sole purpose of sharing .inc files between multiple modules. The modules .module file is empty, as it doesn't do anything. But in the modules .info file I have included:
files[] = includes\Permissions.inc
files[] = includes\Roles.inc
files[] = includes\PermissionsInterface.inc
files[] = includes\RolesInterface.inc
And then in a module that is using these files (a different module), I have included:
use Portal\Permissions;
use Portal\Roles;
$permissions = new Permissions\Permissions();
$roles = new Roles\Roles();
I don't have any include or require statements, because I thought that was covered by the files[] declaration in the shared modules .info file.
However, I'm getting a PHP error that it can't find the class Permissions(). Just wondering what I'm doing wrong?
No hay solución correcta
Licenciado bajo: CC-BY-SA con atribución
No afiliado a drupal.stackexchange