drupal - 为什么表单属性中存在'#'

标签 drupal

使用表格时。为什么要在键上输入“#”?有什么特殊原因吗?

$form['a'] = array(
        '#type' => 'textfield',
        '#title' => t('Score if not chosen'),
      );

最佳答案

在Drupal中,惯例是在与设置(而不是元素)相对应的变量名称的开头添加哈希标记(#)。这样做是为了避免 namespace 冲突。

关于drupal - 为什么表单属性中存在'#',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11376292/

相关文章:

javascript - 链接到关闭的 jquery ui 选项卡中的命名 anchor (drupal)

php - Drupal/Ubercart 在结账时检查某个产品是否在购物车中

Drupal 7 : Get all enabled fields for given node type?

css - Drupal 7 Bootstrap .active css 无法覆盖?

php - drupal 7 db_select 选项

php - 在 Drupal 模块中的何处存储敏感信息?

php - 如何在 drupal 6 的 block 内添加带有 php 的主体类?

drupal - 如果在 Drupal 7 中选择了子术语,如何自动选择分类法父术语?

javascript - Drupal 7 + smoothdivscroll?

PHP 创建可由 Drupal 引用的 .less 文件