Come si chiamo delle funzioni presenti in altri file?

3 contenuti / 0 new
Ultimo contenuto
Come si chiamo delle funzioni presenti in altri file?

Sto facendo un po' di prove e mi trovo a dover chiamare delle funzioni che si trovano in un altro file.
Al momento la struttura del modulo è questa

testmodule
| -- include
|      | - file1.inc
|      | - file2.inc
|
| - testmodule.module
| - testmodule.info

All'interno di testmodule.module ho una funzione con uno switch e a seconda del valore voglio chimare una funzione che si trova in un altro file

<?php
function testmodule_call_external_functions($type)
{
    switch (
$type )
    {
        case
'function1':
            echo
testmodule_function1(); //questa è dentro a file1.inc
           
break;
        case
'function2':
            echo
testmodule_function2(); //questa è dentro a file2.inc
           
break;
    }
}
?>

Ora ho un "call to undefined function" in entrambi i casi.
I file sono già inclusi in testmodule.info.

Come dico a Drupal dove cercare quelle due funzioni?

Drupal Version:

Prendi esempio dal modulo locale_auto_import dove tutti i file sono nella cartella, non c'è bisogno di settare un path nè utilizzare module_load_include
Puoi fare in questo modo
<?php
require_once 'file1.inc';
require_once 'file12inc';
function testmodule_call_external_functions($type...

Grazie