This project is not covered by Drupal’s security advisory policy.

Adds some extra features to Language Sections, currently the ability to set displayed titles of nodes, blocks and Views.

Modules included

  • Language Sections Node Titles to set node titles.
  • Language Sections Block Titles to set block titles.
  • Language Sections View Titles to set titles of Views (page or block).
  • Language Sections Titles needed by all the above.
  • Language Sections Search to allow content to be indexed for use with Drupal's core Search module. See #361069: Only default language is indexed for search.

Language Sections Node Titles

This module allows node titles to be set from text within a LS section in the body of the node.

Target Audience

Users of Language Sections who want to store content for multiple languages in a single node rather than the node-per-language approach.

=== en ===
Title: This is the Title in English
Here is the English text.
=== fr ===
Title: This is the Title in French
Here is the French text.

Usage notes and limitations

The trigger text title: is currently not configurable (other than by editing the module file.) It can be on any line in the section, but must be positioned at the start of a line. It can be in the teaser or main body section of a node (not both!). Only the first title: line per language will be processed, and if none is found, the standard node title will be used. Reminder: LS probably needs to be the first or one of the first filters in your input format configuration.

Placing a title inside an other languages section is probably not needed, as the standard node title can be used. However, one possible application would be to set an alternative title, leaving the standard title to work with Pathauto.

The node title is set when the node is loaded, e.g. for display at node/1234, but of course the real node title in the database is unchanged. Modules which access the title directly from the database see only the real title, not the language-dependent version. Views is one example - see below. In general, modules which call Drupal's node_load() function will see the modified title.

Node titles with Views

Views will display the original node title, not the modified version. Of course, that may be what you want, but if not, here are possible solutions:

  • Use Views Custom Field to display the language-specific title using PHP:
    return ls_node_title($data->nid, 'link');
  • Use Dynamic Field to create a CCK field which displays the language-specific title using PHP:
    return ls_node_title($node);

These solutions work well to display the field, but not as a filter (so you cannot use Views to search on the title.)

NOTE: the ls_node_title() function referred to above is available since 1.8. The examples are simplified for clarity, in practice you should add a function_exists() or similar check.

Language Sections Block Titles

Sets titles for "custom" blocks in a similar way to LS Node Titles.

Language Sections View Titles

Similar again, sets titles for Views - the title must be defined in the header text of the View.

Dependencies

Language Sections version 2.2 or above. If you want to try the dev version of LS Extras, you will probably also need the dev version of Language Sections.

Why is all this not included in the main Language Sections module?

As a design decision, the Language Sections module will remain an input filter only. Any required functionality that doesn't fit that model (see the LS issue queue) will go in via separate modules (if at all) and LS Extras will be a set of such modules.

Feedback

For general comments, complaints, praise etc, please add a review.

Commercial support and customization

Commercial services are available from netgenius.co.uk.

Development version

The current dev version is equivalent to release 1.10.

Project information

Releases