Skip to content

Instantly share code, notes, and snippets.


Jen Lampton jenlampton

View GitHub Profile
jenlampton / add subtitle to page template
Last active Nov 10, 2020
How to add a subtitle to a page template
View add subtitle to page template
.theme file could have something like this...
function hook_preprocess_page(&$variables){
$variables['subtitle'] = FALSE;
if (arg(0) == 'node' && is_numeric(arg(1)) && !arg(2)) {
$node = node_load(arg(1)); // entity cache (in core) should save us here.
if (property_exists($node, 'field_subtitle')) {
View views.view.promoted.json
"_config_name": "views.view.promoted",
"name": "promoted",
"description": "Provides a list of promoted content. Used by default on the front page.",
"module": "node",
"storage": 2,
"tag": "default",
"disabled": false,
"base_table": "node",
"human_name": "Promoted content",
View settings.local.php
* @file
* Backdrop CMS configuration file.
* Database configuration:
$database = 'mysql://backdrop:backdrop01@localhost/norecipe';
View fatal on dev
Fatal error: Uncaught Error: Class 'Drupal\block_content\Access\BlockContentAddAccessCheck' not found in /mnt/www/html/mtccms04dev/docroot/core/lib/Drupal/Component/DependencyInjection/Container.php:269
Stack trace:
#0 /mnt/www/html/mtccms04dev/docroot/core/lib/Drupal/Component/DependencyInjection/Container.php(173): Drupal\Component\DependencyInjection\Container->createService(Array, '')
#1 /mnt/www/html/mtccms04dev/docroot/core/lib/Drupal/Core/Access/CheckProvider.php(100): Drupal\Component\DependencyInjection\Container->get('')
#2 /mnt/www/html/mtccms04dev/docroot/core/lib/Drupal/Core/Access/CheckProvider.php(159): Drupal\Core\Access\CheckProvider->loadCheck('')
#3 /mnt/www/html/mtccms04dev/docroot/core/lib/Drupal/Core/Access/CheckProvider.php(83): Drupal\Core\Access\CheckProvider->loadDynamicRequirementMap()
#4 /mnt/www/html/mtccms04dev/docroot/core/lib/Drupal/Core/Routing/RouteBuilder.php(191): Drupal\Core\Access\CheckProvider->setChecks(Object(Symfon
View views.view.file_admin.json
"_config_name": "views.view.file_admin",
"name": "file_admin",
"description": "Administrative listing for managing files.",
"module": "file",
"storage": 2,
"tag": "default",
"disabled": false,
"base_table": "file_managed",
"human_name": "Administer files",
View exported view for 3614
"_config_name": "views.view.test_reduced_exposed_grouped_options",
"name": "test_reduced_exposed_grouped_options",
"description": "",
"tag": "default",
"disabled": false,
"base_table": "node",
"human_name": "test_reduced_exposed_grouped_options",
"core": "1.14.x-dev",
"display": {
View caption element changes
// Center aligned content requires an additional wrapper to set
// text-align: center.
if ($align === 'center') {
// If the image has a caption
$caption = $node->getAttribute('data-caption');
if ($caption) {
// something like this, but in PHP
// element.replaceWith(figure);
// figure.add(element);
View help
$form['warning'] = array(
'#type' => 'help',
'#display' => 'warning',
'#markup' => t('this is a warning!'),
jenlampton / user.role.board
Last active Nov 8, 2017
user.role.board.json file, with a string of <NULL>s added at the end
View user.role.board
"_config_name": "user.role.board",
"name": "board",
"label": "Board",
"weight": "3",
"permissions": [
"edit own board_member content",
"create sponsor content",
"edit own sponsor content",
"edit any sponsor content",