Skip to content

Instantly share code, notes, and snippets.

View superbiche's full-sized avatar
🕹️
Working from everywhere

Michel Tomas superbiche

🕹️
Working from everywhere
View GitHub Profile
@superbiche
superbiche / README.md
Created April 2, 2019 23:33 — forked from WengerK/README.md
Programatically use Solr on Drupal 8

🔍 Solr (6.1.0+) search Engine & Tika (1.13+) Extractor

We are using solr for search index.

Solr need to be configured for drupal. Follow the INSTALL.txt found in the search_api_solr module.

As a pre-requisite for running your own Solr server, you'll need Java 6 or higher.

Installation

diff --git a/config/schema/taxonomy_menu.schema.yml b/config/schema/taxonomy_menu.schema.yml
index 91f73c0..a247492 100644
--- a/config/schema/taxonomy_menu.schema.yml
+++ b/config/schema/taxonomy_menu.schema.yml
@@ -20,6 +20,9 @@ taxonomy_menu.taxonomy_menu.*:
depth:
type: integer
label: 'Depth'
+ limit:
+ type: integer
diff --git a/src/Entity/TaxonomyMenu.php b/src/Entity/TaxonomyMenu.php
index 27f2c23..800f585 100644
--- a/src/Entity/TaxonomyMenu.php
+++ b/src/Entity/TaxonomyMenu.php
@@ -201,6 +201,7 @@ class TaxonomyMenu extends ConfigEntityBase implements TaxonomyMenuInterface {
$links[$mlid] = $this->buildMenuDefinition($term, $base_plugin_definition);
}
+ \Drupal::moduleHandler()->alter('taxonomy_menu_tree', $links, $terms);
diff --git a/schemata_json_schema/src/Normalizer/jsonapi/SchemataSchemaNormalizer.php b/schemata_json_schema/src/Normalizer/jsonapi/SchemataSchemaNormalizer.php
index d1a8553..a953bdf 100644
--- a/schemata_json_schema/src/Normalizer/jsonapi/SchemataSchemaNormalizer.php
+++ b/schemata_json_schema/src/Normalizer/jsonapi/SchemataSchemaNormalizer.php
@@ -46,7 +46,7 @@ class SchemataSchemaNormalizer extends JsonApiNormalizerBase {
'type' => 'string',
'title' => 'type',
'description' => t('Resource type'),
- 'enum' => [$resource_type->getTypeName()]
+ 'enum' => [$resource_type ? $resource_type->getTypeName() : $entity->getEntityTypeId()]
diff --git a/src/Plugin/jsonapi/FieldEnhancer/UrlLinkEnhancer.php b/src/Plugin/jsonapi/FieldEnhancer/UrlLinkEnhancer.php
new file mode 100644
index 0000000..b5b7d3d
--- /dev/null
+++ b/src/Plugin/jsonapi/FieldEnhancer/UrlLinkEnhancer.php
@@ -0,0 +1,101 @@
+<?php
+
+namespace Drupal\jsonapi_extras\Plugin\jsonapi\FieldEnhancer;
+
diff --git a/src/Plugin/rest/resource/RestMenuItemsResource.php b/src/Plugin/rest/resource/RestMenuItemsResource.php
index 5c0f764..049898e 100644
--- a/src/Plugin/rest/resource/RestMenuItemsResource.php
+++ b/src/Plugin/rest/resource/RestMenuItemsResource.php
@@ -13,7 +13,8 @@ use Drupal\Core\Url;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpKernel\Exception\HttpException;
use Psr\Log\LoggerInterface;
-
+use Drupal\consumers\Negotiator;
@superbiche
superbiche / twig-rows.twig
Created September 28, 2018 15:44
Twig rows
{% block teasers_title %}
<div class="section-title">{{ '_en_ Activities'|t }}</div>
{% endblock teasers_title %}
{% block teasers_list %}
{% for line in rows|batch(rows|length / 3) %}
<div class="grid-3-small-1 has-gutter-xl results-row view-activities">
{% for row in line %}
{% set row_classes = [
@superbiche
superbiche / copy_cert.sh
Last active September 2, 2018 00:39
Copy SSL certificate to vhost
#!/bin/bash
## BE CAREFUL as the "web" directory is not accessible from outside in my setup, you should NEVER put your certs in a web accessible location
mkdir -p /var/www/.../web/ssl
## BE CAREFUL as the "web" directory is not accessible from outside in my setup, you should NEVER put your certs in a web accessible location
cp -afLr /etc/letsencrypt/live/.../privkey.pem /var/www/.../web/ssl/server.key
## BE CAREFUL as the "web" directory is not accessible from outside in my setup, you should NEVER put your certs in a web accessible location
cp -afLr /etc/letsencrypt/live/.../fullchain.pem /var/www/.../web/ssl/server.crt
chown -R web5:web5 /var/www/.../web/ssl
chmod 700 /var/www/.../web/ssl
@superbiche
superbiche / docker.jb-hub.service.example
Last active August 26, 2018 18:46
Setup Jetbrains Hub / YouTrack / TeamCity / UpSource as Sytemd services with Nginx SSL reverse-proxy on Docker & Ubuntu 18
[Unit]
Description=JetBrains Hub Service
After=docker.service
Requires=docker.service
[Service]
TimeoutStartSec=0
Restart=always
User=jb-hub
Group=jb-hub
diff --git a/src/SchedulerManager.php b/src/SchedulerManager.php
index de17b18..69bcad6 100644
--- a/src/SchedulerManager.php
+++ b/src/SchedulerManager.php
@@ -207,6 +207,9 @@ class SchedulerManager {
$event->getNode()->save();
$result = TRUE;
+ $node->setPublished(NODE_PUBLISHED);
+ $node->moderation_state->value = 'published';