https://www.drupal.org/node/2342561
$element[‘something‘] = array( ‘#markup‘ => t(‘This is some content‘), ‘#theme_wrapper‘ => ‘paragraph_wrapper‘, ); /** * Implementation of hook_theme() */ function MYMODULE_theme(){ return array ( ‘paragraph_wrapper‘ = array ( ‘render element‘ => ‘element‘, ), );} function theme_paragraph_wrapper(){ $element = $variables[‘element‘]; // #children is the contents of the element that the // #theme_wrapper was applied to. return ‘<p>‘ . $element[‘#children‘] . ‘</p>‘;} render($element);
时间: 2024-11-05 08:59:30