Moduli
Ho la necessità di imparare bene i moduli e sto seguendo un articolo.
Riguarda il famoso hello_world. Come prima cosa indica oltre alla creazione del file info.yml di creare in file .module dove inserire la function help che dovrebbe essere visualizzata di seguito il codice
use Drupal\Core\Routingh\RouteMatchInterface; /** * Implements */ function hello_world_help($route_name, \Drupal\Core\Routing\RouteMatchInterface $route_match) { switch ($route_name) { // Main module help for the block module. case 'help.page.hello_world': return '<p>' . t('Blocks are boxes of content rendered into an area, or region, of a web page. The default theme Bartik, for example, implements the regions "Sidebar first", "Sidebar second", "Featured", "Content", "Header", "Footer", etc., and a block may appear in any one of these areas. The <a href=":blocks">blocks administration page</a> provides a drag-and-drop interface for assigning a block to a region, and for controlling the order of blocks within regions.', array( ':blocks' => \Drupal::url('block.admin_display'), )) . '</p>'; $output = '' ; $output .= '<h3>'. t('About' ) .'</h3>' ; $output .= '<p>'. t('This is an expample module.' ) . '</p>' ; return $output; default: } }
Ma tutto il contenuto del file mi viene visualizzato in tewsa alla pagina in formato testo
Gaetano
Risposte
Ho fatto altre prove ed ho
Ho fatto altre prove ed ho notatao che l'errore è dato dal case, in quanto non era presente il giusto percorso
Adesso funziona