Javascript – Attempt to load contents via URL in Drupal 8 into the dialog (modal)

First, I apologize if this issue really seems bazaar. Here is the problem. I have a page that contains both static and dynamic content. In the static part, I attached a link that looks like this:

profile

Works flawlessly. The link is clicked and a modal (dialogue) of Drupal Core (powered by jQuery UI) is displayed.

However; In another part of the page, I inserted content with the following code in the DOM:

$ (".insert") .load (data + ".rlp-detail-more", loadComplete) .attr ("data-research-content", dataResearch);

This code contains exactly the same HTML string as above …

However, when I click on the link, I go to content without overlay / modal / dialog.

And it gets weirder …

If I leave the inserted content open and click on the link below in the static content, both will suddenly work … z. For example, the jquery event handler was somehow appended to the inserted content.

My question is … How can I force an attachment to the event handler.

This question gives you a pretty good understanding of the jQuery dialog event and Drupal 8 integration with the jQuery user interface

Enter image description here

8 – How can I forget a Drupal lock?

I understand how locks work, thanks to this post. Very easy:

Function mymodule_long_operation () {
if (lock_acquire (& # 39; mymodule_long_operation & # 39;)) {
// Do the long operation here.
// ...
lock_release (? mymodule_long_operation?);
}
}

My problem is that my function can "hang" if lock_release is never hit. So, how can I get my function working again if something goes wrong?

Function mymodule_long_operation () {
if (lock_acquire (& # 39; mymodule_long_operation & # 39;)) {
// SOMETHING IS WRONG HERE!
lock_release (? mymodule_long_operation?);
}
}

Yes, I can put the entire function around a try / catch and unlock the catch. But as a developer, I often include "the ()" in my code when I'm working. So I can easily put this function in an unexecutable state.

Is there a way to invalidate the lock after a while? Or to lapse the lock as part of a guaranteed garbage collection feature?

Any ideas would be highly appreciated! Many Thanks!

** UPDATE **

Forget, I put the () in my code. What if the function expires? Then it will not reach the publication. I'm sure there are more cases that confirm this as a problem.

8 – Programmatically retrieve the difference between two data

In total:

In a Drupal 8 project, I try to programmatically determine the difference between two different times (current time – creation time of the node).

Application:

I already have "nodeabc" available on the website.

If a particular web form is sent and a custom webform handler is used, I want to receive it Difference in minutes between current time and nodeabc creation time,

Say nodeabc was created on: 24/06/2019 08:00 AM and the web form will be sent to: 24/06/2019 07:00 PMThe difference between the two times is: 660 Protocol.

I already loaded the node after its NID, but what's next?

mojave – 16 GB RAM Macbook Pro never uses more than 8 GB

I have a MacBook Pro in early 2015 that I bought with 16GB of RAM. However, the computer never uses more than 8 GB. This is a screenshot of htop with the computer under heavy load (large Postgres GIST index creation):htop screenshot

Mac system parameters look good:
Enter image description here

I would be glad if someone has an idea what's going on.

PS: MacOS Mojave is running, but the problem has been since I bought the computer.

8 – Configuration and documentation of the scheduling module

I have successfully installed the module but am having trouble configuring the usage.

I have an ENTITY / FIELD DEFINITION error, although I updated entities from drush. This shows me that they need to be installed, but no action is taken. According to protocols, I see that the DB tables are not created and as a result there are errors at each level
I can not access the applicants and appointment lists, and I can not manage appointments for the selected content type node. gives another mistake.

See the error text

The site has an unexpected error. Please try again later.
TypeError: Pass argument 1
Drupal webprofiler Views ViewExecutableFactoryWrapper :: get ()
implement interface Drupal views ViewEntityInterface, given null,
called in
/var/www/html/edu.local/public_html/site/web/modules/contrib/appointments/src/Controller/AppointmentsManagementController.php
on the line 94 in
Drupal webprofiler Views ViewExecutableFactoryWrapper-> get () (line 33
from
modules / contrib / devel / webprofiler / src / Views / ViewExecutableFactoryWrapper.php).
Drupal webprofiler Views ViewExecutableFactoryWrapper-> get (NULL)
(Line: 94)
Drupal terminals controller appointmentmanagementcontroller-> terminlistecontent (& # 39; 3 & # 39;)
call_user_func_array (array, array) (line: 123)
Drupal Core EventSubscriber EarlyRenderingControllerWrapperSubscriber-> Drupal Core EventSubscriber {closure} ()
(Line: 582)
Drupal Core Render Renderer-> executeInRenderContext (object, object)
(Line: 124)
Drupal Core EventSubscriber EarlyRenderingControllerWrapperSubscriber-> wrapControllerExecutionInRenderContext (array,
Array) (line: 97)
Drupal Core EventSubscriber EarlyRenderingControllerWrapperSubscriber-> Drupal Core EventSubscriber {closure} ()
(Line: 151) Symfony Component HttpKernel HttpKernel-> handleRaw (Object,
1) (line: 68) Symfony Component HttpKernel HttpKernel-> handle (Object,
1, 1) (line: 57) Drupal Core StackMiddleware Session-> handle (Object,
1, 1) (line: 47)
Drupal Core StackMiddleware KernelPreHandle-> handle (Object, 1, 1)
(Line: 106) Drupal page_cache StackMiddleware PageCache-> pass (Object,
1, 1) (line: 85)
Drupal page_cache StackMiddleware PageCache-> handle (Object, 1, 1)
(Line: 47)
Drupal Core StackMiddleware ReverseProxyMiddleware-> handle (Object, 1,
1) (line: 38)
Drupal webprofiler StackMiddleware WebprofilerMiddleware-> handle (Object,
1, 1) (line: 52)
Drupal Core StackMiddleware NegotiationMiddleware-> handle (Object, 1,
1) (line: 23) Stack StackedHttpKernel-> handle (object, 1, 1) (line:
693) Drupal Core DrupalKernel-> handle (Object) (line: 19)

Error in the log

Type php Date Friday, June 21, 2019 – 18:36 User eduadmin
Location http: //edu.local/node/3/appointments_management
Reference http: //edu.local/node/3/revisions Message TypeError: Argument
I went to
Drupal webprofiler Views ViewExecutableFactoryWrapper :: get ()
implement interface Drupal views ViewEntityInterface, given null,
called in
/var/www/html/edu.local/public_html/site/web/modules/contrib/appointments/src/Controller/AppointmentsManagementController.php
on the line 94 in
Drupal webprofiler Views ViewExecutableFactoryWrapper-> get () (line 33
from
/var/www/html/edu.local/public_html/site/web/modules/contrib/devel/webprofiler/src/Views/ViewExecutableFactoryWrapper.php)
# 0 /var/www/html/edu.local/public_html/site/web/modules/contrib/appointments/src/Controller/AppointmentsManagementController.php(94):
Drupal webprofiler Views ViewExecutableFactoryWrapper-> get (NULL) # 1
[internal function]:
Drupal terminals controller appointmentmanagementcontroller-> terminlistecontent (& # 39; 3 & # 39;)
# 2 /var/www/html/edu.local/public_html/site/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php (123):
call_user_func_array (array, array) # 3
/var/www/html/edu.local/public_html/site/web/core/lib/Drupal/Core/Render/Renderer.php(582):
Drupal Core EventSubscriber EarlyRenderingControllerWrapperSubscriber-> Drupal Core EventSubscriber {closure} ()
# 4 /var/www/html/edu.local/public_html/site/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php (124):
Drupal Core Render Renderer-> executeInRenderContext (Object (Drupal Core Render RenderContext),
Object (completion) # 5
/var/www/html/edu.local/public_html/site/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97):
Drupal Core EventSubscriber EarlyRenderingControllerWrapperSubscriber-> wrapControllerExecutionInRenderContext (array,
Array) # 6
/var/www/html/edu.local/public_html/site/vendor/symfony/http-kernel/HttpKernel.php(151):
Drupal Core EventSubscriber EarlyRenderingControllerWrapperSubscriber-> Drupal Core EventSubscriber {closure} ()
# 7 /var/www/html/edu.local/public_html/site/vendor/symfony/http-kernel/HttpKernel.php(68):
Symfony Component HttpKernel HttpKernel-> handleRaw (object (Symfony Component HttpFoundation Request),
1) # 8
/var/www/html/edu.local/public_html/site/web/core/lib/Drupal/Core/StackMiddleware/Session.php(57):
Symfony Component HttpKernel HttpKernel-> handle (object (Symfony Component HttpFoundation Request),
1, true) # 9
/var/www/html/edu.local/public_html/site/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(47):
Drupal Core StackMiddleware Session-> handle (object (Symfony Component HttpFoundation Request),
1, true) # 10
/var/www/html/edu.local/public_html/site/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(106):
Drupal Core StackMiddleware KernelPreHandle-> handle (object (Symfony Component HttpFoundation Request),
1, true) # 11
/var/www/html/edu.local/public_html/site/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(85):
Drupal page_cache StackMiddleware PageCache-> pass (object (Symfony Component HttpFoundation Request),
1, true) # 12
/var/www/html/edu.local/public_html/site/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(47):
Drupal page_cache StackMiddleware PageCache-> handle (object (Symfony Component HttpFoundation Request),
1, true) # 13
/var/www/html/edu.local/public_html/site/web/modules/contrib/devel/webprofiler/src/StackMiddleware/WebprofilerMiddleware.php(38):
Drupal Core StackMiddleware ReverseProxyMiddleware-> handle (object (Symfony Component HttpFoundation Request),
1, true) # 14
/var/www/html/edu.local/public_html/site/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(52):
Drupal webprofiler StackMiddleware WebprofilerMiddleware-> handle (object (Symfony Component HttpFoundation Request),
1, true) # 15
/var/www/html/edu.local/public_html/site/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23):
Drupal Core StackMiddleware NegotiationMiddleware-> handle (object (Symfony Component HttpFoundation Request),
1, true) # 16
/var/www/html/edu.local/public_html/site/web/core/lib/Drupal/Core/DrupalKernel.php(693):
Stack StackedHttpKernel-> handle (object (Symfony Component HttpFoundation Request),
1, true) # 17
/var/www/html/edu.local/public_html/site/web/index.php(19):
Drupal Core DrupalKernel-> handle (object (Symfony Component HttpFoundation Request))
# 18 {main}.

In that sense: Do I have to install the Bat module for your module to work properly? Maybe I missed something during the installation?

Need some advice to get ahead,
I have addressed a problem with the module, but no participant answers
https://www.drupal.org/project/appointments/issues/3063371

8 – Target individual elements of a multi-valued field in my page template

There are many ways to achieve this. If you use a custom or subtopic, follow the naming conventions for twig templates and create your own field - node - MYFIELDNAME.html.twig Template. And then you just adapt the markup to your needs.

See Classy's field.html.twig For reference and for the for loop, you can easily customize:

{% for article in article%}
  
    {{}} Item.content
  
{% endfor%}

The goal of the second element in a multi-valued field within page.html.twig Use the following snippet (it starts counting) 0, in order to 0 is the first and 1 is the second point).

{{}} Node.field_MYFIELD.1.value