theme wrapper 例子

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); 

 

 

 

 

posted @ 2015-05-18 18:08  qqisnow2021  阅读(188)  评论(0编辑  收藏  举报