Render content type display mode in custom module [duplicate]

This question already has an answer here:

  • How do I render nodes, now that node_view() has been deprecated? 3 answers

I’m facing the issue with rendering content type in specified display mode (teaser) in my custom module. I have a module which stores NIDs in session, and when user enters specific page, I want to load those NIDs from session, then get specified node’s fields from Drupal DB according to these NIDs and print content types on page in my module in template.

Is this possible, or am I aiming the wrong way?

Example of a ring where every module of finite projective dimension is free?

I’m interested in seeing an example of a ring which is not self-injective where every module admitting a finite projective resolution is free, or at least projective.

Note that self-injectivity says that every monomorphism $ R \to M$ splits (where $ M$ is an arbitrary module), whereas the property I’m looking for looks a bit weaker, requiring this only when $ M$ is free.

I’m happy to look at noncommutative rings.

How to override views-view-field.tpl.php in custom module?

I am trying to override views-view-field.tpl.php in my custom module as suggested in override views-view-fields.tpl.php in custom module but looks like it’s syntaxes are old.

My codes are like:

In mymodule.info

 ; $  Id$      name = My Module   description = Create custom views template.   package = Views   dependencies[] = views   core = 7.x    files[] = mymodule.module   files[] = includes/mymodule.views.inc   ; Information added by drupal.org packaging script on 2011-07-21   version = "7.x-4.1"   core = "7.x"   project = "mymodule"   datestamp = "1311290520" 

In mymodule.module

function mymodule_views_api() {   return array(    'api' => 3.0,    'path' => drupal_get_path('module', 'mymodule') . '/includes',     );  }   function mymodule_theme($  existing, $  type, $  theme, $  path)    {     return array(     'views_view_field__views__ticker' => array(     'variables' => array('view' => NULL, 'options' => NULL,'row' =>NULL),     'template' => 'views-view-field--views--ticker',     'base hook' => 'views_view_field',     'path' => drupal_get_path('module', 'mymodule') . '/includes',           ),        );     } 

In /mymodule/includes/mymodule.views.inc

  function theme_views_view_field__views__ticker($  vars) {      $  view = $  vars['view'];     $  field = $  vars['field'];     $  row = $  vars['row'];      return $  vars['output'];    }    function template_preprocess_views_view_field__views__ticker(&$  vars)           {      $  vars['output'] = $  vars['field']->advanced_render($  vars['row']);    } 

My custom template file views-view-field--views--ticker.tpl.php in /mymodule/includes

 <?php print $  output; ?> 

Problem: it is not overriding views-view-field.tpl.php

I am using drupal version 7.41

How do I locate a specific module, block, view, or node responsible for social sharing buttons?

I am working on a site built by another developer with what I believe is deprecated code being used for the social sharing buttons. The “count” function recently stopped working. I located code in the page source that points me to this module (which hasn’t been updated in three years):

https://github.com/OpenShare/openshare/tree/master/src/modules

I have done a manual search through the Drupal site console for Modules, Blocks, and Views that might be placing the buttons below each article. I have not found anything referencing “Open-share” or similar variants. I located the js files in the Theme’s js folder, but I can’t determine how the buttons are being placed.

How can I locate the module, block, or view responsible and disable it? This thing appears to be coded into the Theme which I can’t wrap my head around, but that’s the only place I can find anything referencing it (and that’s only the js). There is a separate js file in the Theme’s js folder called “openshare”

I found a similar block, with almost the same code except the classes are slightly different and setting it from “Content” to “None” seems to make no change.

Code snippet: ”’html Share

    <span class="new-horizontal-share-wrapper-count" data-open-share-count="facebook" data-open-share-count-url="*website*" data-open-share-node="facebook">0</span>   </a> 

”’

Reduced-size Image of Social Sharing buttons

nginx conf: http2 module not working in Chrome in ubuntu 18.04

I’m trying to setup the http2 module in nginx on a fresh Ubuntu 18.04 vps. Http2 works fine in Firefox (I checked the response headers). Some third party websites indicate that my http2 configuration is ok:

  • https://tools.keycdn.com/http2-test
  • https://www.ssllabs.com/ssltest/analyze.html?d=example.com (I’ve got A+ on this site)

But when I try to open the website on Chrome, it won’t even open (This site can’t be reached), although in the access log (/var/log/nginx/access.log) I get an “HTTP/2.0” 200 response from nginx, indicating that nginx behaves as if everything was ok.

From curl, I’ve this answer:

$   curl -I https://example.com/ HTTP/1.1 200 OK Server: nginx/1.14.0 (Ubuntu) Date: Sun, 19 May 2019 13:20:33 GMT Content-Type: text/html; charset=UTF-8 Connection: keep-alive Vary: Accept-Encoding X-Frame-Options: SAMEORIGIN X-Content-Type-Options:: nosniff X-XSS-Protection: 1;mode=block Strict-Transport-Security: max-age=15768000 

So, not http2, but at least I’ve a fallback to http1.1 with curl

So, apparently http2 works, but not in Chrome (blank page), and I don’t know what’s the problem.

If forgot to say that when I browse the page with Chrome, I don’t get any error in the error log (/var/log/nginx/error.log), however, from time to time, an ssl related error appears (here is a sample):

2019/05/19 14:53:33 [crit] 11931#11931: *639 SSL_do_handshake() failed (SSL: error:1417D102:SSL routines:tls_process_client_hello:unsupported protocol) while SSL handshaking, client: 64.41.200.103, server: 0.0.0.0:443 2019/05/19 14:56:34 [notice] 12616#12616: signal process started 2019/05/19 15:06:52 [notice] 12638#12638: signal process started 2019/05/19 15:08:48 [notice] 12647#12647: signal process started 2019/05/19 15:10:02 [notice] 12724#12724: signal process started 2019/05/19 15:10:07 [crit] 12725#12725: *706 SSL_do_handshake() failed (SSL: error:1417D102:SSL routines:tls_process_client_hello:unsupported protocol) while SSL handshaking, client: 91.107.64.185, server: 0.0.0.0:443 2019/05/19 15:10:07 [crit] 12725#12725: *707 SSL_do_handshake() failed (SSL: error:1417D18C:SSL routines:tls_process_client_hello:version too low) while SSL handshaking, client: 91.107.64.185, server: 0.0.0.0:443 2019/05/19 15:25:22 [crit] 12725#12725: *724 SSL_do_handshake() failed (SSL: error:1417D102:SSL routines:tls_process_client_hello:unsupported protocol) while SSL handshaking, client: 80.82.77.139, server: 0.0.0.0:443 2019/05/19 15:25:23 [crit] 12725#12725: *726 SSL_do_handshake() failed (SSL: error:1417D18C:SSL routines:tls_process_client_hello:version too low) while SSL handshaking, client: 80.82.77.139, server: 0.0.0.0:443 2019/05/19 15:25:23 [crit] 12725#12725: *727 SSL_do_handshake() failed (SSL: error:1417D102:SSL routines:tls_process_client_hello:unsupported protocol) while SSL handshaking, client: 80.82.77.139, server: 0.0.0.0:443 2019/05/19 15:25:27 [error] 12725#12725: *735 open() "/home/me/example.com/www/sitemap.xml" failed (2: No such file or directory), client: 80.82.77.139, server: example.com, request: "GET /sitemap.xml HTTP/1.1", host: "123.456.789.123" 2019/05/19 15:37:22 [notice] 12745#12745: signal process started 

Again, the errors are not provoked by me refreshing the page in Chrome (they are probably bots or other people accessing the website).

Here is my configuration:

In /etc/nginx/nginx.conf:

user www-data; worker_processes auto; pid /run/nginx.pid; include /etc/nginx/modules-enabled/*.conf;  events {         worker_connections 1024;         # multi_accept on; }  http {          ##         # Basic Settings         ##          sendfile on;         tcp_nopush on;         tcp_nodelay on;         keepalive_timeout 65;         types_hash_max_size 2048;         server_tokens off;           ##         # Security settings         ##          # Avoid iframes for clickjacking attacks         # add_header X-Frame-Options DENY;         add_header X-Frame-Options SAMEORIGIN;          # Avoid mime type sniffing         add_header X-Content-Type-Options: nosniff;          # Avoid certain type of XSS attacks (if browser understands it)         add_header X-XSS-Protection "1;mode=block";          ##         # DoS and DDoS Protection Settings         ##          #Define limit connection zone called conn_limit_per_ip with memory size 15m based on the unique IP         limit_conn_zone $  binary_remote_addr zone=conn_limit_per_ip:15m;          #Define limit request to 40/sec in zone called req_limit_per_ip memory size 15m based on IP         limit_req_zone $  binary_remote_addr zone=req_limit_per_ip:15m rate=40r/s;          #Using the zone called conn_limit_per_ip with max 40 connections per IP         limit_conn conn_limit_per_ip 40;          #Using the zone req_limit_per_ip with an exceed queue of size 40 without delay for the 40 additonal         limit_req zone=req_limit_per_ip burst=40 nodelay;          #Do not wait for the client body or headers more than 5s (avoid slowloris attack)         client_body_timeout 5s;         client_header_timeout 5s;         send_timeout 5s;          #Establishing body and headers max size to avoid overloading the server I/O         client_body_buffer_size 256k;         client_header_buffer_size 2k;         client_max_body_size 3m;         large_client_header_buffers 2 2k;           # server_names_hash_bucket_size 64;         # server_name_in_redirect off;          include /etc/nginx/mime.types;         default_type application/octet-stream;          ##         # SSL Settings         ##          ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE         ssl_prefer_server_ciphers on;          ##         # Logging Settings         ##          access_log /var/log/nginx/access.log;         error_log /var/log/nginx/error.log;          ##         # Gzip Settings         ##          gzip on;          gzip_vary on;         # gzip_proxied any;         gzip_comp_level 4;         gzip_buffers 16 8k;         gzip_http_version 1.1;         gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;          ##         # Virtual Host Configs         ##          include /etc/nginx/conf.d/*.conf;         include /etc/nginx/sites-enabled/*; } 

And in (symlink) /etc/nginx/sites-enabled/example.com:

server {          listen 80 default_server;         listen [::]:80 default_server;          # Prevent site from being displayed under a different domain (by creating another domain pointing to our server)         return 301 https://example.com; }   server {     listen 80;     listen [::]:80;      server_name mysite.com;      # Redirect all HTTP requests to HTTPS with a 301 Moved Permanently response.     return 301 https://example.com$  request_uri; }   server {          listen 443 ssl http2;         listen [::]:443 ssl http2;            # certs sent to the client in SERVER HELLO are concatenated in ssl_certificate         ssl_certificate /etc/nginx/certs/mysite.com/fullchain.pem;         ssl_certificate_key /etc/nginx/certs/mysite.com/key.pem;         ssl_session_timeout 1d;         ssl_session_cache shared:SSL:50m;         ssl_session_tickets off;          # modern configuration. tweak to your needs.         ssl_protocols TLSv1.2;         ssl_ciphers 'ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256';         ssl_prefer_server_ciphers on;           ##         # Security settings         ##          # Avoid iframes for clickjacking attacks         # add_header X-Frame-Options DENY;         add_header X-Frame-Options SAMEORIGIN;          # Avoid mime type sniffing         add_header X-Content-Type-Options: nosniff;          # Avoid certain type of XSS attacks (if browser understands it)         add_header X-XSS-Protection "1;mode=block";          # HSTS (ngx_http_headers_module is required) (15768000 seconds = 6 months)         add_header Strict-Transport-Security max-age=15768000;           # OCSP Stapling ---         # fetch OCSP records from URL in ssl_certificate and cache them         ssl_stapling on;         ssl_stapling_verify on;          ## verify chain of trust of OCSP response using Root CA and Intermediate certs         ssl_trusted_certificate /etc/nginx/certs/mysite.com/ca.pem;            root /home/me/example.com/www;          # Add index.php to the list if you are using PHP         index index.php index.html;          server_name mysite.com;         location / {                 # First attempt to serve request as file, then                 # as directory, then fall back to displaying a 404.                 #try_files $  uri $  uri/ =404;                 try_files $  uri $  uri/ /index.php?$  query_string;         }           # pass PHP scripts to FastCGI server         location ~ \.php$   {                 include snippets/fastcgi-php.conf;                  # With php-fpm (or other unix sockets):                 fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;          }          location ~* \.(jpg|jpeg|gif|png|css|js|ico|xml)$   {                 access_log        off;                 add_header Cache-Control public;                 add_header Pragma public;                 add_header Vary Accept-Encoding;                 expires 365d;          }           # deny access to .htaccess files, if Apache's document root         # concurs with nginx's one         #         location ~ /\.ht {                 deny all;         }          location ~ /\.git {                 deny all;         } } 

Here is the output of:

root@example.com:/etc/nginx# nginx -V nginx version: nginx/1.14.0 (Ubuntu) built with OpenSSL 1.1.0g  2 Nov 2017 TLS SNI support enabled configure arguments: --with-cc-opt='-g -O2 -fdebug-prefix-map=/build/nginx-FIJPpj/nginx-1.14.0=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -Wdate-time -D_FORTIFY_SOURCE=2' --with-ld-opt='-Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -fPIC' --prefix=/usr/share/nginx --conf-path=/etc/nginx/nginx.conf --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --lock-path=/var/lock/nginx.lock --pid-path=/run/nginx.pid --modules-path=/usr/lib/nginx/modules --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --with-debug --with-pcre-jit --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module --with-http_auth_request_module --with-http_v2_module --with-http_dav_module --with-http_slice_module --with-threads --with-http_addition_module --with-http_geoip_module=dynamic --with-http_gunzip_module --with-http_gzip_static_module --with-http_image_filter_module=dynamic --with-http_sub_module --with-http_xslt_module=dynamic --with-stream=dynamic --with-stream_ssl_module --with-mail=dynamic --with-mail_ssl_module 

I’ve created the certificate using Certbot, and it worked fine.

What am I missing?

Unable to find unlocked_ioctl file while creating loadable kernel module

I have following implementation to to create a loadable kernel module.

// The prototype functions for the character driver -- must come before the struct definition static int     dev_open(struct inode *, struct file *); static int     dev_close(struct inode *, struct file *); #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,35))    static int     dev_ioctl(struct inode *, struct file *, unsigned int, unsigned long); #else    static long    dev_ioctl(struct file *, unsigned int, unsigned long); #endif  static ssize_t dev_read(struct file *, char *, size_t, loff_t *); static ssize_t dev_write(struct file *, const char *, size_t, loff_t *);  /** @brief Devices are represented as file structure in the kernel. The file_operations structure from  *  /linux/fs.h lists the callback functions that you wish to associated with your file operations  *  using a C99 syntax structure. char devices usually implement open, read, write and release calls  */ static struct file_operations fops = {    .open    = dev_open,    .release = dev_close,    .read    = dev_read,    .write   = dev_write,    #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,35))       .ioctl = dev_ioctl    #else       .unlocked_ioctl = dev_ioctl    #endif }; 

In my test file I am doing something like this

#include<stdio.h> #include<stdlib.h>      #include<errno.h>     #include<fcntl.h>     #include<string.h>     #include<unistd.h>     #include<linux/version.h>    printf("Calling ioctl:\n");       #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,35))       ret = ioctl(fd, "22:22:22:22", 0, 0);    #else       m_ret = unlocked_ioctl(fd, "22:22:22:22", 0, 0);    #endif 

However it fails with error

warning: implicit declaration of function ‘unlocked_ioctl’ 

Translation functor on parabolic Verma module

I want to prove that following proposition by using Theorems/propositions in Representations of Semisimple Lie Algebras in the BGG Category $ \mathcal{O}$ .

Define $ \Lambda := \{\nu \in \mathfrak{h}^* : \langle\nu,\alpha^\lor\rangle \in \mathbb{Z} \ \text{for all }\alpha \in \Phi^+\}. $

Define $ \Lambda^+ := \{\nu \in \mathfrak{h}^* : \langle\nu,\alpha^\lor\rangle \in \mathbb{Z}^{\ge 0} \ \text{for all }\alpha \in \Phi^+\}. $

Define $ \Lambda^+_I := \{\nu \in \mathfrak{h}^* : \langle\nu,\alpha^\lor\rangle \in \mathbb{Z}^{\ge 0} \ \text{for all }\alpha \in \Phi^+_I\}. $

The $ \mathbb{Z}$ -span $ \Lambda_r$ of $ \Phi$ is called the root lattice.

Recall that a weight $ \eta\in \mathfrak{h}^*$ is antidominant if $ \langle \eta+\rho,\alpha^{\lor}\rangle\not\in\mathbb{Z}^{>0}$ for all $ \alpha\in \Phi^+$ .

For $ w \in W$ and $ \eta\in \mathfrak{h}^*$ , define a shifted action of $ W$ (called the dot action) by $ w \cdot \eta := w(\eta + \rho) – \rho$ . If $ \eta, \nu \in \mathfrak{h}^*$ , then we say that $ \eta$ and $ \nu$ are linked if for some $ w \in W$ , we have $ \nu = w \cdot \eta$ .

The weight $ \eta \in \mathfrak{h}^*$ is regular if $ |W \cdot \eta| = |W|$ or, equivalently, if $ \langle \eta + \rho,\alpha^\lor\rangle \neq 0$ for all $ \alpha\in\Phi$

By exercise 1.13, $ M\in\mathcal{O}_{\chi_\lambda}$ has a direct sum decomposition $ M=\bigoplus M_i$ such that all weights of each $ M_i$ are contained in a single coset of the root lattice $ \Lambda_r$ in $ \mathfrak{h}^*$ . Therefore, the category $ \mathcal{O}_{\chi_\lambda}$ decomposes as a direct sum of full subcategories, which can be indexed by the nonempty intersection of the orbit $ W\cdot\lambda$ with the cosets $ \mathfrak{h}^*/\Lambda_r$ . We use the antidominant weight $ \mu$ in the intersection to parameterize the corresponding subcategory of $ \mathcal{O}_{\chi_\lambda}$ . We denote this subcategory by $ \mathcal{O}_{\mu}$ .

We say $ \eta$ and $ \nu$ are compatible if $ \nu – \eta \in\Lambda$ .

Fix $ \eta, \nu \in \mathfrak{h}^*$ such that $ \eta,\nu$ are compatible and write $ pr_\eta$ and $ pr_\nu$ for the natural projections of the category $ \mathcal{O}$ onto $ \mathcal{O}_{\chi_\eta}$ and $ \mathcal{O}_{\chi_\nu}$ . Let $ \overline{\nu-\eta}$ be the unique $ W$ -conjugate in $ \Lambda^+$ of $ \nu-\eta$ . If $ M \in \mathcal{O}$ , then $ M \mapsto pr_ \nu \left(L(\overline{\nu-\eta}) \otimes (pr_\eta M)\right)$ followed by inclusion into $ \mathcal{O}$ defines an exact functor $ \mathcal{O} \to \mathcal{O}$ . Its restriction to $ \mathcal{O}_{\chi_\eta}$ (without the inclusion) relates the two subcategories $ \mathcal{O}_{\chi_\eta}$ and $ \mathcal{O}_{\chi_\nu}$ . Write $ T^\nu_\eta$ for the resulting functor on $ \mathcal{O}$ (or on $ \mathcal{O}_{\chi_\eta}$ ). We call $ T^\nu_\eta$ a translation functor.

Proposition: Let $ \eta,\nu\in \Lambda_I^+$ , Suppose $ \eta,\nu\in \Lambda_I^+$ are integral, regular and antidominant. Then there is an equivalence of categories between $ \mathcal{O}_\nu$ and $ \mathcal{O}_\eta$ such that (i) $ T^{\eta}_{\nu}(L(x\cdot \nu))\cong L(x\cdot \eta)$ and $ T^{\eta}_{\nu}(M(x\cdot \nu))\cong M(x\cdot \eta)$ for $ x\in W$ . (ii) If $ x\cdot\nu$ is in $ \Lambda_I^+$ then $ T^{\eta}_{\nu}(M_I(x\cdot \nu))\cong M_I(x\cdot \eta)$ .

Proof: Since $ \eta,\nu\in \Lambda_I^+$ are integral, regular and antidominant, it holds that $ \eta,\nu$ are compatible. Since $ \eta,\nu$ are integral, we have $ \eta^\natural=\eta,\nu^\natural=\nu$ and hence $ \eta^\natural,\nu^\natural\in F$ where $ \Phi_F^-=\Phi^+$ , $ \Phi_F^0=\Phi_F^+=\emptyset$ . Applying Theorem 7.6, Proposition 7.7 and Theorem 7.8, we deduce that there is an equivalence of categories $ T^{\eta}_{\nu}$ between $ \mathcal{O}_{\nu}$ and $ \mathcal{O}_{\eta}$ satisfying (i).

For a proof of (ii) it suffices to show that $ T^{\eta}_{\nu}(M_I(x\cdot \nu))\cong M_I(x\cdot \eta)$ by the properties of the full subcategory. In fact, there is an exact sequence (Theorem 9.4) \begin{equation}\label{longexact1} \bigoplus_{\alpha\in I} M(s_\alpha x \cdot \nu) \xrightarrow{f} M(x \cdot \nu) \xrightarrow{g} M_I (x \cdot \nu) \to 0. \quad\quad(1) \end{equation} Applying $ T^{\eta}_{\nu}$ to (1), we get another exact sequence \begin{equation}\label{longexact2} \bigoplus_{\alpha\in I} M(s_\alpha x \cdot \eta) \xrightarrow{T^{\eta}_{\nu}(f)} M(x \cdot \eta) \xrightarrow{T^{\eta}_{\nu}(g)} T^{\eta}_{\nu}(M_I(x \cdot \nu)) \to 0. \quad\quad(2) \end{equation} On the other hand, by replacing $ \nu$ in (1) with $ \eta$ , we can get an exact sequence in $ \mathcal{O}_{\eta}$ : \begin{equation}\label{longexact3} \bigoplus_{\alpha\in I} M(s_\alpha x \cdot \eta) \xrightarrow{f’} M(x \cdot \eta) \xrightarrow{g’} M_I (x \cdot \eta) \to 0. \quad\quad(3) \end{equation}

Since (2) is exact, it holds that $ T^{\eta}_{\nu}(g)$ is surjective and $ \ker(T^{\eta}_{\nu}(g))=\mathrm{Im}(T^{\eta}_{\nu}(f))$ , we have $ T^{\eta}_{\nu}(M_I(x \cdot \nu))= \mathrm{Im}(T^{\eta}_{\nu}(g)) \cong M(x\cdot\eta)/\ker(T^{\eta}_{\nu}(g)) =M(x\cdot\eta)/\mathrm{Im}(T^{\eta}_{\nu}(f)).$

Since (3) is exact, it holds that $ g’$ is surjective and $ \ker(g’)=\mathrm{Im}(f’)$ , we have $ M_I(x \cdot \eta)=\mathrm{Im}(g’) \cong M(x\cdot\eta)/\ker(g’) =M(x\cdot\eta)/\mathrm{Im}(f’). $

My question: How to show $ T^{\eta}_{\nu}(f)=f’$ ?

Get confirmation email from ProductAlert module

Currently I have extended Magento_ProductAlert module so that user can subscribe to out of stock product by entering his email address. So far everything works – email gets saved in database and email about back in stock product gets also sent to user.

But now I want to send one more email – lets call it “confirmation email” – the email which is sent to user when he has successfully subscribed to product to get notification when this product will be back in stock. I’ve already tried some variations which I’ve found on internet but with no luck.

Can someone maybe help me what I have to extend to send 2 emails instead of 1?

First email – “You have succsessfully subscribed for product X” (this is what I want to add)

Second email – “Hello, We wanted to inform you that product X is back in stock” (this is what I already have)

Thank you!

How can I enable a block, set the pages it is visible on, and dynamically change the contents of the block from inside my custom module?

I have a custom module in Drupal 8 called hello world. in that module I make a custom block called Hello World!, I am trying to enable the block and set it’s region to “sidebar_second” from inside my module, I am also trying to only have it visible on a certain content type and dynamically change the contents of the block to be links to the other nodes in that content type. I can’t figure out how to do that, can anyone show me how to do all that?

Thanks!