DrupalSites

From HerzbubeWiki
Jump to: navigation, search

This page has site-specific information about the configuration of my Drupal websites. It also provides an overview over module and theme usage of each site (important for upgrades).

The general configuration that applies more or less to all sites can be found on the DrupalConfiguration page.


Filesystem level

Drupal installations reside in

/var/www/drupal-x.y

The current Drupal version used by production sites is symlinked to /var/www/drupal, e.g.

ln -s /var/www/drupal-7.14 /var/www/drupal

The Apache document root for a site either points directly to /var/www/drupal (may be problematic: no special robots.txt or sitemap.txt), or it is a separate directory that refers to the content of /var/www/drupal via symlinks. For instance www.herzbube.ch:

mkdir /var/www/www.herzbube.ch
cd /var/www/www.herzbube.ch

for FILE in autoload.php core .htaccess index.php modules profiles sites themes update.php vendor web.config; do
  echo "Adding symlink $FILE ..."
  ln -s /var/www/drupal/$FILE /var/www/www.herzbube.ch/$FILE
done

# Example for content
ls -la /var/www/www.herzbube.ch

total 48
drwxr-xr-x  4 root root  4096 Oct  3 20:20 .
drwxr-xr-x 23 root root  4096 Oct  6 16:55 ..
lrwxrwxrwx  1 root root    28 Oct  3 20:02 autoload.php -> /var/www/drupal/autoload.php
lrwxrwxrwx  1 root root    20 Oct  3 20:02 core -> /var/www/drupal/core
drwxr-xr-x  2 root root  4096 Jul  4  2016 Eredain
lrwxrwxrwx  1 root root    25 Oct  3 20:02 .htaccess -> /var/www/drupal/.htaccess
lrwxrwxrwx  1 root root    25 Oct  3 20:02 index.php -> /var/www/drupal/index.php
drwxr-xr-x  2 root root  4096 Jul  4  2016 isfdb
lrwxrwxrwx  1 root root    23 Oct  3 20:02 modules -> /var/www/drupal/modules
-rw-r--r--  1 root root   448 Jul  4  2016 PGPHerzbubeAtHerzbubeDotCH.txt
-rw-r--r--  1 root root 13462 Jul  4  2016 pgp-key-signing-policy.html
lrwxrwxrwx  1 root root    24 Oct  3 20:02 profiles -> /var/www/drupal/profiles
-rw-r--r--  1 root root  2068 Oct  3 20:18 robots.txt
-rw-r--r--  1 root root   146 Jul  4  2016 sitemap.txt
lrwxrwxrwx  1 root root    21 Oct  3 20:02 sites -> /var/www/drupal/sites
-rw-r--r--  1 root root  1264 Jul 20  2016 svn-replaced-by-git.html
lrwxrwxrwx  1 root root    22 Oct  3 20:02 themes -> /var/www/drupal/themes
lrwxrwxrwx  1 root root    26 Oct  3 20:02 update.php -> /var/www/drupal/update.php
lrwxrwxrwx  1 root root    22 Oct  3 20:02 vendor -> /var/www/drupal/vendor
lrwxrwxrwx  1 root root    26 Oct  3 20:02 web.config -> /var/www/drupal/web.config

Note that for some sites it may be OK to also link robots.txt.


Module/theme usage

Each row in the following table corresponds to a module/theme as it appears in the "Administration" menu of Drupal's web interface. This is not necessarily the same level of granularity as when module/theme packages are installed in the file system. For instance, when the Views package is installed, several modules appear in Drupal's web interface. The "Remarks" column documents the package that each module/theme is part of.


Module/Theme herzbube.ch grunzwanzling.ch kino.herzbube.ch Remarks
Core modules
Actions - - -
Activity Tracker - - -
Aggregator - - -
Automated Cron - - -
Ban - - -
BigPipe - - -
Block yes yes yes
Book - - -
Breakpoint - - -
CKEditor - - -
Color yes yes yes
Comment yes yes - Not needed for grunzwanzling.ch. I enabled the module during the migration process and now can't disable it again.
Configuration Manager - - -
Contact - - -
Content Moderation yes - -
Contextual Links - - -
Custom Block yes - -
Custom Menu Links yes - -
Database Logging yes yes yes
Field yes yes yes
Field UI yes - -
Filter yes yes yes
Forum - - -
Help yes - -
History - - -
Inline Form Errors - - -
Internal Dynamic Page Cache yes yes yes
Internal Page Cache yes yes yes
Layout Discovery - - -
Media - - -
Menu UI yes - -
Node yes yes yes
Path yes - -
Quick Edit - - -
RDF - - -
Responsive Image - - -
Search yes - -
Settings Tray - - -
Shortcut - - -
Statistics yes - -
Syslog - - -
System yes yes yes
Taxonomy yes - -
Testing - - -
Text Editor - - -
Toolbar - - -
Tour - - -
Update Manager yes yes yes
User yes yes yes
Views yes - -
Views UI yes - -
Workflows yes - -
Authentication
External Autentication yes yes yes
Chaos Tool Suite
Chaos tools yes - -
Chaos Tool Suite (experimental)
Chaos tools blocks - - -
Chaos tools views - - -
Core (experimental)
Field Layout - - -
Layout Builder - - -
Media library - - -
Migrate Drupal Multilingual - - -
Workspaces - - -
Field types
Datetime yes - -
Datetime Range - - -
File yes yes yes
Image - - -
Link yes - -
Options yes - -
Telephone - - -
Text yes yes yes
Lightweight Directory Access Protocol
LDAP Authentication yes yes yes
LDAP Authorization Provider - - -
LDAP Help - - -
LDAP Query - - -
LDAP Servers yes yes yes
LDAP Users yes yes yes
Migration
Migrate yes yes yes
Migrate Drupal yes yes yes
Migrate UI yes yes yes
Multilingual
Configuration Translation - - -
Content Translation - - -
Interface Translation - - -
Language - - -
Other
Pathauto yes - -
Redirect yes - -
Redirect 404 - - -
Redirect Domain - - -
Token yes - -
Spam Control
CAPTCHA yes - -
Image CAPTCHA yes - -
reCAPTCHA yes - -
User Interface
External Links yes - -
Web services
HAL - - -
HTTP Basic Authentication - - -
RESTful Web Services - - -
Serialization - - -


herzbube.ch

Theme

  • Default theme = Nexus
  • Default administration theme = Adminimal


Content type "Book review"

The "Book review" content type defines a structure for writing a (duh!) book review. Drupal's field system makes it easy to define the structure with new fields that will contain the relevant data. So far so good. The problem is the layout: By default, Drupal content types are displayed to the end user as a form-with-fields, each field having a label, the label being followed by a colon (e.g. "Plot:"), the label being laid out in bold but in the same font size as the main text. However, I would like the end user to see the node as a page-with-sections: Fields should not be recognizable as such, instead they should be perceived as sections with a heading. When I came up with the "Book review" content type in Drupal 6 (or was it Drupal 5) I investigated a number of ways how to achieve this (modules markup, form_markup, panes), but did not find a way to achieve the desired effect. My conclusion at that time was that I would probably need to modify the theme I am using, or that I would have to write my own module that defines the content type complete with its own CSS. I shied away from that, therefore I invented the following kludge that adds section headings as fields with default content to the content type. The heading fields are defined to contain HTML, which allows to embed the section heading marked up with a H3 element. Because as a content editor I don't want to repeatedly enter those headings, including markup, the fields define the static headings as default content.

Although a better solution might be available these days in Drupal 8, I am too lazy to invest more time, so I am still using the same old kludge.


The following config info was written at a time when the CCK module had to be used to add field and content types to Drupal. I have never updated the info for a newer Drupal version, so it's bound to contain many inaccuracies. Use at your own risk.


Things to change on the add page

  • Name = Book review
  • Type = bookreview
  • Description = An article with special fields, such as Plot, Opinion, etc., for writing a book review.
  • Submission form settings
    • Body field label = "" (empty string); this removes the body field
  • Workflow settings
    • Default options
      • Promoted to front page = no
    • Comment settings
      • Default display order = Date - oldest first
      • Anonymous commenting = Anonymous posters may leave their contact information
      • Location of comment submission form = Display below post or comments


After the content type has been added, new fields can be configured for it under the "Manage fields" tab:

  • Plot heading field
    • Label = Plot heading
    • Name = field_plot_heading
    • Type = Text
    • Widget = Text field
    • After defininig these things, click save, then on the next page that is displayed change the following settings:
      • Default value = <h3 style="margin-top:1em">Synopsys</h3> (Note on the style attribute: This is a hack for increasing the distance of the heading from the previous fivestar rating field. In the current theme, without modification the heading follows immediately after the fivestar rating field, which looks really ugly. Using a style instead of a markup element (e.g. <pP>&nbsp;</p>) is good, and using the CSS unit "em" makes the layout flexible in case the viewer has a special font size or screen resolution)
      • Text processing = filtered text
    • After defining these things, click save, then on the next page select "Configure" for the heading field that has just been added
      • In the "Default value" selection the option "Input format" has become available (because in the previous step we have set "text processing" to "filtered text")
      • Set "Input format" = "full HTML". This is required so that the style attribute defined in the default value will not be filtered out
    • Click save again, now this field is done
  • Plot text field
    • Label = Plot
    • Name = field_plot
    • Type = Text
    • Widget = Text area (multiple rows)
    • After defininig these things, click save, then on the next page that is displayed change the following settings:
      • Rows = 10
      • Text processing = filtered text
  • Opinion heading and text fields (same as Plot fields, see above, but the heading field without the style attribute; the input format therefore does not have to be changed, either)
  • Recommendation heading and text fields (same as Plot; the header field uses the style attribute because the content type's teaser format will display recommendation after rating, not plot after rating)
  • Bibliography heading and text fields (same as Opinion)
  • Rating heading field (same as Opinion heading)
  • Rating field
    • Type = Fivestar Rating
    • Widget = Stars
    • After clicking save, accept all default values
  • Links heading field (same as Opinion heading)
  • Links field
    • Type = Link
    • Widget = Link
    • After defininig these things, click save, then on the next page that is displayed change the following settings:
  • Author heading text field (same as Opinion heading)
    • Note: Because the next field is going to be a multi-valued field, it might come in handy that the editor is allowed to change the value of this heading field: If there is more than one author, the editor will probably set this heading to "Authors" (plural)
  • Author text field
    • Label = Author
    • Name = field_author
    • Type = Text
    • Widget = Text field
    • After defininig these things, click save, then on the next page that is displayed change the following settings:
      • Number of values = unlimited
      • Text processing = filtered text
  • Rearrange fields and their headings in the following order: Title, Author, Rating, Plot, Opinion, Recommendation, Bibliography, Links

After fields have been defined, switch to the "Manage Display" tab to modify some settings

  • Sub-tab "Default": For all fields, set Label = Hidden
  • Sub-tab "Teaser": For fields Author, Rating and Recommendation, set Format = Default. For all other fields set Format = Hidden.

Add a new "book review writer" role that has the following permissions:

  • Create bookreview content
  • Delete own bookreview content
  • Edit own bookreview content
  • View revisions
  • Create url aliases


More configuration:

  • Taxonomy
    • Go to "Administer > Structure > Taxonomy"
    • Check the new content type on the appropriate vocabularies ("Topics" and "Article style"). TODO: What's this? In D7 and D8 there is no way how to "check a content type on a vocabulary". Is the idea to add terms to these vocabularies (e.g. an article style "Book review")?
    • When writing a book review node, the article style should be set to "Review", and the topic to one of the terms from underneath the "Books" term.
  • Pathauto
    • Go to "Administer > Configuration > Search and metadata > URL aliases"
    • On the tab "Automated alias settings", open the section "Node path settings" and set "Pattern for all Book review paths" = "review/[node:title]-by-[node:field_author]"
  • Views
    • Go to "Administration > Strucure > Views" (D7)
    • Add a new view that defines the following things:
      • Arguments: Created year, Created month
      • Filters: Node type = book_review, Published = yes
      • Sort criteria: Node:Post date, descending
      • Display "default"
        • Title = Book reviews
        • Use pager = yes (full pager)
        • More link = yes
      • Display "page"
        • A page that lists 5 nodes
        • Path = book_reviews
      • Display "block"
        • A block that lists 5 nodes
        • Style = Table
        • Fields = Content: Title; Content: Author; Global: Custom text; Content: Post date; Content: Rating
        • Table columns have no headings. This is achieved by disabling the "Create label" setting for each field
        • To save space, the field "Global: Custom text" is used to display title and author in the same column. For this to work the custom text field must appear after the two fields it references, and the two referenced fields must be excluded from view.
        • Date format = "F d, Y" (using spaces allows line breaks which saves space)
        • Title = "Most recent book reviews"
        • The field "Content: Title" is set to link to the original node
  • Menus
    • Add an item to the menu "Primary links". Path = book_reviews, Title = "Book reviews"
  • Blocks
    • Activate the "Book reviews" block on the left sidebar
    • Configure the block so that it does not show on the page "book_reviews"


grunzwanzling.ch

Configuration

  • Configuration > System > Basic site settings
    • Default front page = /node/1
  • Structure > Block Layout
    • Configure the block "Site Branding", then disable the site name
    • Disable the block "User login"
    • Add the block "User menu", but restrict its use to authenticated users only


Default theme = Stark


Content

  • In Drupal 8 a node always must have a title. Drupal does not allow to enter a title that consists of a space only, so I use an "em space" character as the title. The entity character for this is &emsp;, but of course you can't enter the title with that, you have to enter it as-is, by copy&pasting it from some Unicode capable text editor.