Module Description
The CSS 3 column-count attribute creates documents (or parts of documents) with multiple columns. See http://www.quirksmode.org/css/multicolumn.html for examples. Not all browsers support this attribute, and those that do implement it inconsistently.
This filter imitates the effect of the column-count attribute just for lists. It provides consistency and a simple input format: simply put each list item on a separate line. For example, it will format
<multicolumn cols="3" type="ol"> one two three four five six seven </multicolumn> into something like this:
* one
* two
* three
* four
* five
* six
* seven
(depending on how you style <ol>).
The cols and type attributes can be given in either order. The first should be a positive integer and defaults to 1; the second should be one of 'ul', 'ol', or 'plain', and defaults to 'ul'. If type is set to 'plain', then the lists will be formatted as unordered lists with list-style: none;. Any additional attributes are passed to theme('multicolumn_list') (see below) as key-value pairs in the array $variables['attributes'].
List items are created based on line breaks in the input text. Do not insert <li> tags.
If you use the HTML filter after this one, make sure that it allows the tags that this filter produces. It is all right to use the HTML filter before this one, since a "prepare" function replaces <multicolumn> with [multicolumn] before the HTML filter is run. If you use the Line Break filter, do not use it before this one: it changes line breaks, which this filter uses to separate list items.
Theming
Drupal 8 The module uses three Twig templates:
multicolumn-list.html.twig Format one column. multicolumn-row.html.twig Arrange columns side by side. multicolumn-comment.html.twig Wrap text in HTML comment markers. You can override these by copying the templates to your theme and modifying them to suit your needs.
The default template multicolumn-list.html.twig adds in-line CSS styles. If you override the template, and you know in advance how many columns you will be using, then you may prefer to add the CSS through your theme.
Render elements are passed to multicolumn-row.html.twig, not strings, so it is easy for your version of this function to make changes before final rendering.
If you do not care to add <!-- multicolumn start --> and <!-- multicolumn end --> to your pages, simply have your version of multicolumn-comment.html.twig generate an empty string.
Drupal 7 The module defines three theme functions:
theme_multicolumn_list($variables) Format one column. theme_multicolumn_row($variables) Arrange columns side by side. theme_multicolumn_comment($variables) Wrap text in HTML comment markers. You can override these by defining functions MYTHEME_multicolumn_list(), MYTHEME_multicolumn_row(), and MYTHEME_multicolumn_comment() (replacing MYTHEME with the name of your theme) in your theme's template.php file.
The default implementation of theme_multicolumn_list() adds in-line CSS styles. If you write your own theme functions, and you know in advance how many columns you will be using, then you may prefer to add the CSS through your theme.
Render elements are passed to theme_multicolumn_row(), not strings, so it is easy for your version of this function to make changes before final rendering.
If you do not care to add <!-- multicolumn start --> and <!-- multicolumn end --> to your pages, simply have your version of theme_multicolumn_comment() return an empty string.
TODO
* I could add support for definition lists if anyone wants such a feature.
This filter imitates the effect of the column-count attribute just for lists. It provides consistency and a simple input format: simply put each list item on a separate line. For example, it will format
<multicolumn cols="3" type="ol"> one two three four five six seven </multicolumn> into something like this:
* one
* two
* three
* four
* five
* six
* seven
(depending on how you style <ol>).
The cols and type attributes can be given in either order. The first should be a positive integer and defaults to 1; the second should be one of 'ul', 'ol', or 'plain', and defaults to 'ul'. If type is set to 'plain', then the lists will be formatted as unordered lists with list-style: none;. Any additional attributes are passed to theme('multicolumn_list') (see below) as key-value pairs in the array $variables['attributes'].
List items are created based on line breaks in the input text. Do not insert <li> tags.
If you use the HTML filter after this one, make sure that it allows the tags that this filter produces. It is all right to use the HTML filter before this one, since a "prepare" function replaces <multicolumn> with [multicolumn] before the HTML filter is run. If you use the Line Break filter, do not use it before this one: it changes line breaks, which this filter uses to separate list items.
Theming
Drupal 8 The module uses three Twig templates:
multicolumn-list.html.twig Format one column. multicolumn-row.html.twig Arrange columns side by side. multicolumn-comment.html.twig Wrap text in HTML comment markers. You can override these by copying the templates to your theme and modifying them to suit your needs.
The default template multicolumn-list.html.twig adds in-line CSS styles. If you override the template, and you know in advance how many columns you will be using, then you may prefer to add the CSS through your theme.
Render elements are passed to multicolumn-row.html.twig, not strings, so it is easy for your version of this function to make changes before final rendering.
If you do not care to add <!-- multicolumn start --> and <!-- multicolumn end --> to your pages, simply have your version of multicolumn-comment.html.twig generate an empty string.
Drupal 7 The module defines three theme functions:
theme_multicolumn_list($variables) Format one column. theme_multicolumn_row($variables) Arrange columns side by side. theme_multicolumn_comment($variables) Wrap text in HTML comment markers. You can override these by defining functions MYTHEME_multicolumn_list(), MYTHEME_multicolumn_row(), and MYTHEME_multicolumn_comment() (replacing MYTHEME with the name of your theme) in your theme's template.php file.
The default implementation of theme_multicolumn_list() adds in-line CSS styles. If you write your own theme functions, and you know in advance how many columns you will be using, then you may prefer to add the CSS through your theme.
Render elements are passed to theme_multicolumn_row(), not strings, so it is easy for your version of this function to make changes before final rendering.
If you do not care to add <!-- multicolumn start --> and <!-- multicolumn end --> to your pages, simply have your version of theme_multicolumn_comment() return an empty string.
TODO
* I could add support for definition lists if anyone wants such a feature.
Module Link
Project Usage
56
Security Covered
Covered By Security Advisory
Version Available
Production
Module Summary
This module aims to solve the inconsistency in browser support for the CSS column-count attribute by providing a filter that imitates the effect specifically for lists, offering consistency and a simple input format.
Data Name
multicolumn