Content type event
has an entity reference field containing a location
.
We want the following URL structure:
# For the location
/location-title
# For the event
/location-title/event/event-title
<?php | |
/** | |
* Implements theme_suggestions_HOOK_alter(). | |
*/ | |
function mytheme_theme_suggestions_paragraph_alter(array &$suggestions, array $variables) { | |
/** @var \Drupal\paragraphs\ParagraphInterface $paragraph */ | |
$paragraph = $variables['elements']['#paragraph']; | |
/** @var \Drupal\Core\Entity\ContentEntityInterface $parent */ | |
$parent = $paragraph->getParentEntity(); |
cp -pv --parents `git diff --name-only master..develop -- source/directory` target/directory |
# Change working directory to a temporary location | |
cd ~/temp | |
# Export config to "config" directory | |
# Change `@mysite.local` to your local drush alias | |
drush @mysite.local config-export --destination=~/temp/config | |
# Tar all files in "config" directory to `config.tar.gz` | |
tar -czf config.tar.gz -C config . |
# The following assumes credentials are saved in .my.cnf (or similar) | |
# | |
# Create a file with a drop table command for each table. | |
# (Replace "database" with the name of the database.) | |
# | |
mysqldump --add-drop-table --no-data database | grep 'DROP TABLE' > ~/little_bobby_tables.sql | |
# Check. | |
# |
<?php | |
use Drupal\views\Views; | |
// Get the View title and URL from a path. | |
$path = '/my-path'; | |
$url = \Drupal::service('path.validator')->getUrlIfValid($path); |
/* http://stackoverflow.com/a/19054794/698511 */ | |
body.no-scroll { | |
left: 0; | |
-webkit-overflow-scrolling: touch; | |
position: fixed; | |
top: 0; | |
width: 100%; | |
} |
Content type event
has an entity reference field containing a location
.
We want the following URL structure:
# For the location
/location-title
# For the event
/location-title/event/event-title
uuidgen | tr "[:upper:]" "[:lower:]" |
<?php | |
/** | |
* Implements hook_preprocess_HOOK(). | |
*/ | |
function module_preprocess_node__content_type(&$variables) { | |
$node = $variables['elements']['#node']; | |
// Get time as separate variable. | |
// Calculate using system timezone. |
<?php | |
// See https://api.drupal.org/api/drupal/core%21includes%21bootstrap.inc/function/drupal_get_path/8.4.x | |
$core_path = \Drupal::service('file_system')->realpath( | |
drupal_get_path('core', '') | |
); |