How to add a pager to the TOP of a forum in Drupal 8?

I'm using the standard forum module provided with Drupal 8. The problem is that when I view a forum node, it displays the pager at the bottom. I want the pager to also appear at the top.

The closest I could come is the model edition "comment-comment_forum.html.twig". If I put random text at the top of this template, I can see the text appear in the right place I want. But if I put this:

{{}} Pager

So nothing is visible. So, the model how – comment_forum.html.twig does not know what is "pager".

Does anyone know where is the right place to add a pager at the top of the forum posts?

8 – Retrieve the latest published version (moderation state) of the node during the transition to published

I want to get the latest published review of a node whose moderation status of the content is "published." The code below works well until I put a node in the "published" state, at which point it can not find anything

                $ query = Drupal :: database () -> select (& # 39; content_moderation_state_field_data & # 39; ms);

$ query-> join ('node_field_revision', 'nf', 'nf.nid = ms.content_entity_id AND nf.vid = ms.content_entity_revision_id AND nf.langcode = ms. langcode & # 39;);

// Join table so that we can check the type of content this node is an entity.
$ query-> join ('node_field_data', 'nd', 'nd.nid = nf.nid');

$ query-> fields (& # 39; nf), ['nid', 'vid'])

// Compare moderation states in the site workflow.
$ query-> condition (& # 39; ms.workflow & # 39 ;, & # 39; site_content & # 39;);

// The node must be in a state of moderation published in the site workflow.
$ query-> condition (& # 39; ms.moderation_state & # 39 ;, $ moderation_state);

// Content Type of node.
$ query-> condition ('nd.type', $ bundle_id);

return $ query-> execute () -> fetchAll ();

How can I get this to return the latest published version of a node when the state goes to published?

This code is called by a service called from hook_entity_type_update ().

8 – How to add an additional eventlistener to a menu object in an attached library

This is my first Drupal 8 project and I am having a problem with how to attach an additional event handler to an object.
I am working on a custom theme using Radix as a basic theme. I'm using Superfish as a menu module.
One of the problems is that Superfish creates an additional "root" menu called "Menu" that is displayed when the user clicks the Hamburger Bootstrap menu. You must then click on 'Menu'. to display the current menu (accordion).
I found a code snippet in a problem: https://www.drupal.org/project/superfish/issues/2891228 that hides the "Menu" toggle, but I can not get it to work.

I've set a library definition and created a script.js:

import "popper.js";
import "bootstrap";

(function ($, Drupal) {
Drupal.behaviors.helloWorld = {
attach (context) {
console.log ("Hello World");
}
};


Drupal.behaviors.myMainMenu = {
attach (context) {
console.log ("myMainMenu:" + context.toString ());
$ (". navbar-collapse", context) .once (& # 39; myMainMenu & # 39;). sure (
"show shown.bs.collapse show.bs.collapse",
() => {
console.log ("navbar-collapse");
if (! $ ("# superfish-main-accordion"). hasClass ("sf-expand")) {
console.log (& # 39; no expand & # 39;);
$ ("superfish-main-toggle")
.Click on()
.hide();
}
});
}
};
}) (jQuery, Drupal);

I know that the script is running because I see "Hello World" and "myMainMenu" + a glob in the console several times. But I never get to receive the other messages from the console.

I also know the code in the if statement because if I run it manually in the console, it works as expected.

What should be the right code?

8 – How to include a patch in a JS library?

I'm using the Superfish library in my Drupal 8.7.x project. I included it in composer.json like this:

    "Repositories": [
        {
            "type": "composer",
            "url": "https://packages.drupal.org/8"
        },
        {
            "name": "mehrpadin/superfish",
            "version": "2.1",
            "type": "drupal-library",
            "source": {
                 "url": "https://github.com/amclin/Superfish-for-Drupal.git",
                 "comment": "use amclin because of pull request 29",
                 "type": "git",
                 "reference": "c11a5ac10f8c99f809858c0384a4c415411778ce"
            },
            "require": {
                 "composer/installers": "~1.0"
             }
         }
    ]
.....

Now that I have found a fix for a problem that I have, I would like to automatically apply the fix to the JS file. This is very similar to how I can apply patches to Drupal modules.
More precisely this one:

https://www.drupal.org/files/issues/smallscreen_patch.diff

An idea how to do that?

8 – Update the kernel to a specific version with Composer

My site has not been updated for two months, some new updates have been released.
The main version of my site is 8.5.6.
Before running Compose update -with-dependencies I have read the release notes of the latest version of core (8.6.2), which say:

Sites on 8.5.x should update immediately to Drupal 8.5.8, and
plan to update the latest version 8.6.x before May 2019.

How to update the old kernel to Drupal 8.5.8?
How to specify this version in the CLI, which command?
Finally, I want to update it with the latest version.

8 – How is the user disconnection process supposed to work?

I've built a complete private site. Everything seems to work. When users want to disconnect, they are redirected from / user / logout / user / login? Destination = /, which seems to be normal behavior, for what I understand.

A customer told me that he was not redirected to / user / login? Destination = / but stayed on / user / logout, getting an access error denied.

I can not reproduce this problem.

How is the disconnection supposed to work? Does the redirection from / user / logout to / user / login? Destination = / is the normal behavior?

8 – Hook to start afer configuration import

The configuration system has already switched to the events and event documentation described in "My First Subscriber to a Drupal 8 Event" How to subscribe to a configuration event:

https://www.drupal.org/docs/8/creating-custom-modules/subscribe-to-and-dispatch-events

See also this example of the Color module:

/core/modules/color/src/EventSubscriber/ColorConfigCacheInvalidator.php

cacheTagsInvalidator = $ cache_tags_invalidator;
}

/ **
* Invalidate cache tags when a color theme configuration object changes.
*
* @param  Drupal  Core  Config  ConfigCrudEvent $ event
* The event to be treated.
* /
public function onChange (event ConfigCrudEvent $) {
// Changing the color settings of a theme causes the asset's theme library.
// contain the CSS color file to edit to use another file.
if (strpos ($ event-> getConfig () -> getName (), & # 39; color.theme. & # 39;)) === 0) {
$ this-> cacheTagsInvalidator-> invalidateTags (['library_info'])
}
}

/ **
* {@inheritdoc}
* /
public static function getSubscribEvents () {
$ events[ConfigEvents::SAVE][]    = ['onChange'];
$ events[ConfigEvents::DELETE][]    = ['onChange'];

returns $ events;
}

}

GreenCloudVPS.com – Windows VPS Starting at $ 8 / month

Hi

I bought a vps and a dedi at GreeCloudVPS and here's a review, the vps was very slow even though it was delivered quickly, but you can tell his old machines he came up with a period 180-day trial that it is a new installation without tweaks, IE secuirty is turned on, all the new things you can imagine were out of the box, so j & # 39; I hoped that the dedicated would be a better experience,

The dedicated was delivered in 2 days, and here is the surprise, it's all OVH that you can go to buy yourself at half price, and comes with a test window that you can install yourself, you can see the links below

SV1 OVH (if you buy it at your price) = 59 | GreenCloudVps Price = 105

SV2 OVH (if you buy it yourself) Price = 65 | GreenCloudVps = 115

SV3 OVH (if you buy it at your price) = 59 | GreenCloudVps = 122

SV4 OVH (if you buy it at your price) = 60 | GreenCloudVps = 125

SV5 OVH (if you buy it yourself) Price = 63 | GreenCloudVps = 127

Same thing for their France one, the price by oneself is even cheaper, for a windows test that you can install yourself? :) It's a side that their site was down all day, so why are you paying more for nothing?

Also it's their vps node data centers

This is where my fps were turned on. You can see that these are refurbished machines that are not only super old and slow, but have no guarantee as to the execution of your data on their crappy servers. This company is actually a scam launched in Vietnam by a child or two.

I would avoid them totally, the price is not expensive for a reason

ShineServers.Com | Since 2010 || 50% flat discount || QuadCore, 8 GB RAM, 1 TB hard drive, 4 IPv4 | NewProxyLists

Shine Servers LLP is a privately owned Indian-based web hosting company founded in 2010. Shine Servers offers the most comprehensive suite of secure, fully protected and private web hosting services in the world. All shared, VPS and dedicated servers are located at SmartDC Datacenter in the Netherlands. All equipment, including Shine Servers LLP servers, is placed in a private corridor inside the SmartDC. Our network consists of the best connections such as AMS-IX, DECIX, L-INX, Tinet, NTT, Telia and Level3. Shine Servers manages its own global IPv4 / IPv6 network (AS202905). This premium network consists of several large and small public transport providers and is connected to the largest Internet exchanges in Europe. This combination of different providers and Internet exchanges ensures maximum performance. Low latency and low availability are the essence of the premium Shine server network.

We understand that every minute is a minute too many.

Shine Servers now offers the following server configurations at a very attractive price to this community! There has never been a better time to check out Shine servers.

Payment method: PayPal, Credit / Debit Cards, Bitcoin, Altcoins and Payza


Here are some configurations of choice to consider:

Intel Quadcore X3440 For $ 125 USD / m
8 GB of ECC DDR3 RAM
1 TB SATAII
1 Gbit dedicated port
Bandwidth of 35 TB
Location: Netherlands
4 IPv4
Time of activation: 5 to 12 hours (exception of the week-end)

Click to place your order

Intel Xeon E3 – 1260L for 155 USD / m
8 GB of ECC DDR3 RAM
SATAII 250X2 GB
1 Gbit dedicated port
Bandwidth of 35 TB
Location: Netherlands
4 IPv4
Time of activation: 5 to 12 hours (exception of the week-end)

Click to place your order

Intel Xeon E3-1246v3 For $ 190 USD / m
16 GB of ECC DDR3 RAM
2 TB SATAII
1 Gbit dedicated port
Bandwidth of 35 TB
Location: Netherlands
8 IPv4
Time of activation: 5 to 12 hours (exception of the week-end)

Click to place your order

Intel Xeon E3-1230 For $ 290 USD / m
32 GB of RAM
SSD 250 GB + SATAIII 2TB
1 Gbit dedicated port
Bandwidth of 35 TB
Location: Netherlands
8 IPv4
Time of activation: 5 to 12 hours (exception of the week-end)

Click to place your order

2x Intel Xeon E5620 For $ 300 USD / m
32 GB of RAM
512 GB SSD
4X1 TB SATAII
1 Gbit dedicated port
Unmeasured bandwidth
Location: Netherlands
16 IPv4
Time of activation: 5 to 12 hours (exception of the week-end)

Click to place your order

2x Intel Xeon E5-2620v3 For $ 380 USD / m
64 GB of RAM
980 GB SSD + 2 TB SATA
1 Gbit dedicated port
Bandwidth of 100 TB
Location: USA
Time of activation: 5 to 12 hours (exception of the week-end)

Click to place your order

2x Intel Xeon E5-2687W V3 For $ 750 USD / m
64 GB of RAM
32 TB SATAIII
1 Gbit dedicated port
Bandwidth of 100 TB
Location: Netherlands
Time of activation: 5 to 12 hours (exception of the week-end)

Click to place your order

Always nothing ?
Do not see a plan that suits your needs? Do not worry!
We can offer you a custom server to meet your needs.
Contact us with your requirements and we will send you a quote within 12 hours!

It's so easy! Convinced? the time to reach us:
Send us an email:

[email protected]
Directly via the contact form: http://www.shineservers.com/contact.php
Websites: www.shineservers.com || www.shineservers.in

8 – Change the display mode based on the URL

I have nodes whose content type is X that I would like to render differently depending on the path of the node. I would like to use the default view mode for an access path alias and a custom view mode for the other path path alias. These aliases were created using the Pathauto module. both point to the same node.

  • / url / alias1 / path => / node / 123 (default view mode)
  • / url / alias2 / path => / node / 123 (custom view mode)

I've tried using mymodule.routing.yml to do it, but that does not seem to have been recovered by the routing system.

mymodule.program:
path: & # 39; / url / alias2 / path & # 39;
by default:
_controller:  Drupal  mymodule  Controller  RoutesController :: setViewMode & # 39;
requirements:
_access: & # 39; TRUE & # 39;

When I click on the alias with the custom view mode, I get the default view mode. I put a log statement in the setViewMode function of the route controller and it is not reached. This suggests that the routing is not "triggered".

Am I missing something or trying to do something that Drupal 8 can not handle?

I've looked at routing and path aliases, but that does not quite answer my question.