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
# 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. | |
# |
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 | |
namespace Drupal\my_module\Plugin\search_api\processor; | |
use Drupal\search_api\Processor\ProcessorPluginBase; | |
/** | |
* Excludes entities marked as 'excluded' from being indexes. | |
* | |
* @SearchApiProcessor( |
<?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', '') | |
); |
cp -pv --parents `git diff --name-only master..develop -- source/directory` target/directory |
<?php | |
$module_handler = \Drupal::service('module_handler'); | |
$path = $module_handler->getModule('your_module')->getPath(); |
<?php | |
/** | |
* Format a date to be saved in Drupal. | |
* | |
* @param string $date | |
* | |
* @return string | |
*/ | |
private function formatDate($date) { |
<?php | |
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; | |
/** | |
* Implements hook_preprocess_HOOK(). | |
*/ | |
function my_module_preprocess_node(&$variables) { | |
$node = $variables['node']; | |
$nodetype = $node->getType(); |