Site Building

6.16. Configuring Text Formats and Editors for Drupal 8, 9, 10, and 11

Goal

Add a horizontal rule tag to the Basic HTML text format, and a corresponding button to its editor configuration.

Site prerequisites

  • The core Filter, Editor, and CKEditor modules must be installed. They are installed on your site when you install with the core Standard installation profile.
  • The Basic HTML text format must exist. This is created on your site when you install with the core Standard installation profile.

Steps

Sprout Video
  1. In the Manage administrative menu, navigate to Configuration > Content authoring > Text formats and editors (admin/config/content/formats). The Text formats and editors page appears. Note that the names of the text formats that came with your installation profile are shown in English on this page; see Section 2.7, “Concept: User Interface, Configuration, and Content translation” for an explanation.
  2. Click Configure for the Basic HTML text format. The Basic HTML page appears.
  3. Note that CKEditor is selected in the Text editor field. This allows you to configure the editor’s toolbar.
  4. Drag the horizontal line button from Available buttons to the Active toolbar. Toolbar items can be visually grouped together using a vertical divider. As an alternative to dragging, you can tab to select buttons and then move them using keyboard arrow keys.

    Image
    Configuring the editor

  5. Note that you can change the Filter processing order.
  6. Under Filter settings > Limit allowed HTML tags and correct faulty HTML, in the field Allowed HTML tags, verify that <hr> is present (adding its editor button will automatically update the allowed tags).

    Image
    Configuring the HTML tags

  7. Click Save configuration. You will be taken back to the Text formats and editors page. A message will be displayed saying that the text format has been updated.

    Image
    Confirmation message for text format configuration

Expand your understanding

If you do not see the effect of these changes in your site, you might need to clear the cache. See Section 12.2, “Clearing the Cache”.

Drupal User Guide