首页 > 其他 > 详细

Drupal 主题的表现形式

时间:2017-07-23 20:33:36      阅读:245      评论:0      收藏:0      [点我收藏+]

1、template.php

/**
 * Implements hook_theme().
 */
function yourtheme_theme($existing, $type, $theme, $path) {
  $base = array(
    ‘render element‘ => ‘form‘,
    ‘path‘ => drupal_get_path(‘theme‘, ‘yourtheme‘) . ‘/templates/forms‘,
  );
  return array(
    ‘commerce_checkout_form_checkout‘ => $base + array(
      ‘template‘ => ‘commerce-checkout-form-checkout‘,
    ),
  );
}
/**
 * Preprocessor for commerce_checkout_form_checkout theme.
 */
function yourtheme_preprocess_commerce_checkout_form_checkout(&$variables) {
  /* Add or modify your variables */
}

2、/templates/forms/commerce-checkout-form-checkout.tpl.php

// Render or hide parts of $form: var_export($form);
// Example given:
hide($form[‘title‘]);
print render($form[‘first‘]);
// Render remaining form elements as usual.
print drupal_render_children($form);

Drupal 主题的表现形式

原文:http://www.cnblogs.com/wzzkaifa/p/7225689.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!