【问题标题】:Change submit button value on Drupal 8 search form block更改 Drupal 8 搜索表单块上的提交按钮值
【发布时间】:2017-06-04 13:22:58
【问题描述】:

我想在 Drupal 8 的提交按钮中显示一个 FontAwesome 图标。

为此,我想更改搜索表单的值以使用图标的 Unicode 表示 ()。

我在 D7 (https://www.drupal.org/node/154137, https://www.drupal.org/node/45295) 中找到了有关如何执行此操作的信息,但是如何最好地完成 D8?但是如何在 Drupal 8 中最好地做到这一点呢?

【问题讨论】:

    标签: php drupal twig font-awesome


    【解决方案1】:

    经过更多阅读,我终于在这里找到了答案:https://drupal.stackexchange.com/questions/197439/how-to-replace-the-search-submit-button-with-a-font-awesome-character/212185#212185

    使用 hook_form_search_block_form_alter 可以直接访问搜索块表单:

    function ThemeName_form_search_block_form_alter(&$form, &$form_state) {
      $form['actions']['submit']['#value'] = html_entity_decode('');
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-10-04
      • 2016-08-06
      • 1970-01-01
      • 1970-01-01
      • 2015-10-25
      • 1970-01-01
      相关资源
      最近更新 更多