8 – How to get parent paragraph from a child block preprocess

Searched all over the place but cannot find anything similar. Here’s the issue…

The setup:

  • ‘Page’ content type
  • ‘Block Content’ paragraph type

The ‘Page’ content type has a field for referencing the ‘Block Content’ paragraph, called “Components” (set to unlimited). Now we can use paragraphs within our page. Simple.

The ‘Block Content’ paragraph type has a field for referencing blocks (using the module Block Field). It also has two other fields for title and subtitle. These fields need to be displayed on the referenced block template for this paragraph instance. This is the issue.

I have included some images to show the setup.

I am trying to use theme_preprocess_block to inject these fields (title and subtitle) into the correct block using $vars(‘plugin_id’) from the block preprocess but the issue is that the block does not know its paragraph parent. And if I don’t know the parent, I can’t retrieve these fields that I need to inject into the block.

This answer suggests using the following to get the parent:

$parent   = $variables('elements')('#node')->_referringItem->getEntity();

But in my case I could not find anything equivalent in my block preprocess function.

Update 1:

I tried (from within theme_preprocess_block):


This give the following error:

Error: Call to a member function getEntity() on null in limit_preprocess_block__banner_block()

Update 2:

I just dumped the $vars from the preprocess function and noticed that there seems to be the paragraph id in there. But I don’t know how to access it from the $vars variable. Is it possible? (see dump image below)

enter image description here


enter image description here


enter image description here


enter image description here


enter image description here


enter image description here

public key infrastructure – What are requirements of Key Usage extension of parent and child certificates?

https://tools.ietf.org/html/rfc5280.html#section- has this to say:

If the keyUsage extension is present, then the subject public key
MUST NOT be used to verify signatures on certificates or CRLs unless
the corresponding keyCertSign or cRLSign bit is set. If the subject
public key is only to be used for verifying signatures on
certificates and/or CRLs, then the digitalSignature and
nonRepudiation bits SHOULD NOT be set. However, the digitalSignature
and/or nonRepudiation bits MAY be set in addition to the keyCertSign
and/or cRLSign bits if the subject public key is to be used to verify
signatures on certificates and/or CRLs as well as other objects.

So the expectation is that a CA’s KeyUsage will assert { keyCertSign | cRLSign } without asserting digitalSignature. And the end-entity/leaf cert will of course want to assert digitalSignature, therefore there’s no expectation of subsetting.

python – Como Funciona el MDI Parent PyQT5

tengo un problema con pyqt5, estoy intentado crear un pequeño CRUD, cuando envió la información a la base de datos SQLITE3 desde la ventana independiente si la envía, pero cuando abro el formulario dentro del mdiArea se muestra el formulario pero no envía la información.
Este es parte del código.

#importacion de los Forms o Views
from FrmCyclist import Ui_FrmCyclist
from FrmActivity import Ui_FrmActivity

self.frmCyclist = QtWidgets.QMainWindow()
self.frmActivity = QtWidgets.QMainWindow()

self.subWindowCyclist = QtWidgets.QMdiSubWindow()
self.subWindowActivity = QtWidgets.QMdiSubWindow()

def OpenForm(self,QMainWindow,QMdiSubWindow,Instance):
    if(QMdiSubWindow in self.mdiArea.subWindowList()):
        for w in self.mdiArea.subWindowList():
    if(QMdiSubWindow not in self.mdiArea.subWindowList()):
        QMdiSubWindow.closeEvent = lambda event: event.accept()
        window = Instance

def OpenFormCyclist(self):

No me genera ningún tipo de error ya que no se ejecutan las funciones del formulario hijo.

firebase – Use parent document of the collection in firestore Security Rules

This is my firestore collection path /chat/{doc}/messages

I written rules like below,

match /chat/{documents=**}{
  allow create: if request.auth.uid != null;
  allow read, update, delete: if request.auth.uid in resource.data.users;
match /chat/{doc}/messages/{documents=**}{
  allow read, create:if request.auth.uid != null;
  allow update, delete: if false;

The problem is messages collection under the doc. I want to write rule like below for messages

match /chat/{doc}/messages/{documents=**}{
  allow read, create:if request.auth.uid in doc.data.users;
  allow update, delete: if false;

I am not well experienced in firestore rules. Can someone help me to resolve the issues? Thanks in advance!

postgresql – Deleting rows from child table without deleting from parent

I have 2 tables , connected with inheritance.
I want to delete some rows from the child table when datetime>2days. The deletion part works , but it deletes rows from the parent as well.

    CREATE OR REPLACE FUNCTION earthquakes_trigger()
        INSERT INTO earthquakes VALUES (NEW.*);
        DELETE FROM ONLY earthquakes WHERE datetime < (now() - '2 days'::interval);
        RETURN NULL;
    LANGUAGE plpgsql;
    CREATE TRIGGER earthquakes_trigger
            BEFORE INSERT ON earthquakes_ovr
            FOR EACH ROW EXECUTE PROCEDURE earthquakes_trigger();

Parent table : earthquakes_ovr
Child table: earthquakes

PS. I also tried to “break” the trigger function , to have the deletion part as a child trigger function ,but it didn’t work as well.

8 – I can’t filter the child view based on a value from the parent view

I have read many of the questions asked on this site, but none of them suited my problem. What is the need to make a Users view that shows below its created contents.

I have a website with 3 roles. Each role has the permission to create a content type. Users of the “Truckers” role can create nodes whose type is Trucks. The Username value is automatically added to a field, in order to identify which truck driver that truck belongs to. That field is an entity reference.

I need to create a view that shows users of the Truckers role and the trucks which belong to them. I created 2 views. One of them, based on the Trucks content type, lists the trucks, and among other fields, shows the Username of the truck driver who created it; the other one, based on Users, lists the users who have the Truckers role.

Using Views field view, I added the Trucks view as a field inside the Truckers view. However, I didn’t find any combination of contextual filters, relationships, etc. that gives the desired result.

In the second image, you can see that the Trucks view is shown below each user of the Truckers role, but it shows all trucks, not just those created by the trucker.

List of trucks

Views field view in parent view

I am not a programmer. How could I achieve the result I need? Is there a contextual filter, relationship, that I need to set? They have many options and I do not understand all of them correctly and in depth.

I am using Drupal 8.9.13 and Views field view 8.x-1.0-beta3.

shortcode – Check if parent page has child page of certain slug

I currently have a function that checks to see if the page is a parent, and if so, do stuff. But I also want to check to see if the parent has a child page that has a certain slug.

Basically, how would I check to see if a WordPress page has a child that matches a slug of my-child-slug?

In short, this is my current function:

/* Using Slug, make iconbox Shortcode */
function fs_sc_location_iconbox( $atts ){ 
    // begin output buffering

    global $post; // if outside the loop

    $response = 'Nothing to see here';

    if ( $post->post_parent ) {
        // This is a subpage
        $slug = $post->post_name;

    } else {
        // This is not a subpage
        $slug = $post->post_name;

        // Check if has child page with slug of my-child-slug
        // ** NEED LOGIC HERE **

        // if this parent page has a child with the desired child slug...
        $response = 'Yes, this parent has a child page that we are looking for.';


    // if there is a slug
    if ($slug) {
        // output the default response, unless this page is a parent of the desired child page
        echo $response;
    // end output buffering, grab the buffer contents, and empty the buffer
    return ob_get_clean();
add_shortcode( 'fs_location_iconbox', 'fs_sc_location_iconbox' );

How can I updated te // ** NEED LOGIC HERE ** area, so that it checks if this parent page has a child of the my-child-slug slug? And if so, then it will set a new value for the $response variable.

mysql – Get a parent and the children using the parent name

Is there a way to get a parent and its children using a single query?

CREATE TABLE `servers` (
  `name` varchar(20) NOT NULL,
  `parent_id` int DEFAULT NULL,
  PRIMARY KEY (`id`)

INSERT INTO servers (name) VALUES ('kvm01'), ('kvm02')

INSERT INTO servers (name, parent_id) VALUES ('web01', 1), ('db01', 1), ('web02', 2), ('db02', 2)

Current output:

mysql (lab)> SELECT child.id FROM servers AS parent LEFT JOIN servers AS child ON (child.parent_id = parent.id) WHERE parent.name = 'kvm01';
| id   |
|    3 |
|    2 |
2 rows in set (0.00 sec)

Expected output:

| id   |
|    3 |
|    2 |
|    1 |