Aidez-moi à comprendre pourquoi pas ma forme se style un La sites/all/modules/pecapture/thèmes/pecapture-displayform.tpl.phpDrupal Module - formulaire dans le bloc non modèle application
Voilà mon code:
/**
* Implementation of hook_theme()
*/
function pecapture_theme() {
$path = drupal_get_path('module', 'pecapture') . '/theme';
return array(
'pecapture_displayform' => array(
'arguments' => array('form' => NULL),
'template' => 'pecapture-displayform',
'path' => $path,
),
);
}
en gros, cela dit que les fichiers thématiques sont dans le module/dossier thème ($ path)
Il y a une fonction de thème pecapture_displayform ($ form = NULL), appelé en utilisant le thème ('pecapture_displayform ', $ form) où $ form est un tableau de forme Drupal
Il y a un fichier modèle pecapture_displayform.tpl.php à $ path
function pecapture_block($op = 'list', $delta = 0, $edit = array()) {
$block = array();
if ($op == "list") { // Generate listing of blocks from this module, for the admin/block page
$block[0]["info"] = t('Persistent E-mail Capture Form Block');
}
else /* if ($op == 'view') */ { // Generate our block content
$block['subject'] = ''; //'Persistent E-mail Capture Form';
$block['content'] = pecapture_displayForm();
}
return $block;
} // function pecapture_block
Cela dit que lorsque vous regardez le bloc, utilisez pour générer le contenu de la fonction pecapture_displayForm(). $ block obtient php print() ed
/**
* Callback for pecapture_theme
*/
function pecapture_displayform() {
return drupal_get_form('pecapture_blockform');
}
Ce dit retourne le tableau de formulaire drupal au format html (pour la sortie)
function pecapture_blockform(&$form_state) {
/* the form, standard ... */
Ceci est le contenu du formulaire, il est typique.
J'ai essayé d'appeler la fonction de thème explicitement dans pecapture_displayform:
return theme('pecapture_displayform', $form);
et
return theme('pecapture_displayform', drupal_get_form($form));
Alors pourquoi la forme ne passe pas par pecapture-displayform.tpl.php?
Avez-vous vidé le cache? ou la reconstruction du registre de thème? – Nikit