Initial 8.0 version working
This commit is contained in:
commit
c913af859c
6
disciplearea.info.yml
Normal file
6
disciplearea.info.yml
Normal file
@ -0,0 +1,6 @@
|
||||
name: Above All - Disciple Area
|
||||
type: module
|
||||
description: 'Helps the Disciple Area to work'
|
||||
package: Above All - Twelve Tribes
|
||||
core_version_requirement: ^9 || ^10
|
||||
dependencies:
|
31
disciplearea.module
Normal file
31
disciplearea.module
Normal file
@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
use Drupal\Core\Entity\EntityInterface;
|
||||
use Drupal\Component\Utility\Html;
|
||||
|
||||
/**
|
||||
* Implements hook_ENTITY_TYPE_presave().
|
||||
*/
|
||||
function disciplearea_node_presave(EntityInterface $node) {
|
||||
|
||||
if (($node->getType() == 'blog_post') && ($node->isNew())) {
|
||||
|
||||
$value = \Drupal::request()->query->get('cid');
|
||||
$value = Html::escape($value);
|
||||
|
||||
$node->set('field_community', $value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// In NEWS FOR THIS PLACE, we needed to combine Posts and Events, sorted by Posts.authored_on and Events.field_when
|
||||
function disciplearea_views_query_alter( $view, $query )
|
||||
{
|
||||
switch ( $view -> id() )
|
||||
{
|
||||
case 'masonry':
|
||||
$query -> orderby = [];
|
||||
$query -> addOrderBy( NULL, "CASE node_field_data.type WHEN 'event' THEN node__field_when.field_when_value ELSE node_field_data.created END", 'DESC', 'order_field' );
|
||||
break;
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user