ACF Repeater for registering Gutenberg Blocks

I am working on a template where I want to make a function that I can use the repeater field from ACF to combine that with the acf_register_block_type();.

What I have is the following:

 <?php          $  rows = get_field('register_block');     if( $  rows ) {         foreach( $  rows as $  row ) {           $  register_block_name_function = $  row['register_block_name'];           $  register_block_name = $  row['register_block_name'];             function $  register_block_name_function() {                      acf_register_block_type(array(                     'name' => $  register_block_name,                     'title' => __('3 Columns'),                     'render_template' => '/acf/blocks/gutenberg/columns-3.php',                     'category' => 'blocks',                     'mode' => 'auto',                     'supports' => array(                         'align' => true,                         'mode' => true,                         'anchor' => true,                     ),                     'icon' => array(                       // Specifying a background color to appear with the icon e.g.: in the inserter.                       'background' => '#B53A73',                       // Specifying a color for the icon (optional: if not set, a readable color will be automatically defined)                       'foreground' => '#FFF',                       // Specifying a dashicon for the block                       'src' => 'align-left',                     ),                 ));                  }                  // Check if function exists and hook into setup             if (function_exists('acf_register_block_type')) {                 add_action('acf/init', $  register_block_name_function);             }              }     }   ?> 

Is there a way that I can use 1 ACF Repeater to create multiple Gutenberg bocks by just adding a name.

How to get data from WordPress $wpdb into React Gutenberg Blocks Frontend?

I am using $ wpdb to do a mysql query and get the data from a php file.

$  results = $  wpdb->get_results("SELECT * FROM table_name");  

Now, I have registered a Gutenberg block with the wordpress api..

the component is a .js file, which uses (WordPress React) under the hood:

import { registerBlockType } from "@wordpress/blocks"; import { __ } from "@wordpress/i18n"; import edit from "./pruefungenEdit";  registerBlockType("mytheme-blocks/pruefungen", {     title: __("Pruefungen Block", "mytheme-blocks"),     description: __("Display a Table of exams", "mytheme-blocks"),     category: "mytheme-category",     icon: {         background: "#f03",         foreground: "#fff",         src: "dashicons-database",     },     keywords: [__("pruefungenBlock", "mytheme-blocks")],     edit: edit,     save: () => {         return <p>Test</p>;     }, }); 

This is my React component that I use for above edit() function:

import { Component } from "@wordpress/element"; import { withSelect } from "@wordpress/data"; import { __ } from "@wordpress/i18n";  class PruefungenEdit extends Component {      render() {         //where to get the data from the query in .php file??         return <div>Data...</div>;     } }  export default PruefungenEdit; 

I can’t use php code obviously inside my .js react file.. I thought about setting up a small nodejs server that queries my localhost mysql table, and send that data via custom api route. THen I query that route on my react frontend and display the data… but that looks like too much workaround to me, I mean php is itself some kind of backend, does WordPress not offer that possibility to query mysql data and send it to the frontend somehow?

My question now is, how do I get the data from the php file into my gutenberg Block that I registered for the block editor frontend?

Tidy HTML formatting in Gutenberg HTML blocks

When forming my own HTML blocks, trying to keep my HTML tidy for easy debugging purposes is a pain because tab spacing cannot be used, and therefore multiples of 4 spaces or more has to be used for each indentation level. Having to count 1,2,3,4…1,2,3,4…1,2,3,4 for example to keep everything in line slows down page production too.

Is there a way of allowing tab spacing to be used within Gutenberg blocks?

Creating a block matrix from arrays of blocks

I am trying to generate a matrix from square blocks. Effectively, I have a $ n×n$ matrix polynomial $ P(l)$ , the $ qth$ derivative of $ P(l)$ with respect to $ l$ , which is denoted by $ P^{(q)} (l)$ , and a block of zeroes, which I’ll just call $ 0$ . I have some integer $ k$ such that if $ k=1$ then I am generating the matrix

$ $ R= \begin{pmatrix} P(l) \end{pmatrix} $ $

If $ k=2$ then I should generate

$ $ R = \begin{pmatrix} P(l) & 0 \ \frac{1}{1!} P^{(1)}(l) & P(l) \end{pmatrix} $ $

If $ k=3$ then

$ $ R = \begin{pmatrix} P(l) & 0 & 0 \ \frac{1}{1!} P^{(1)}(l) & P(l) & 0 \ \frac{1}{2!} P^{(2)}(l) & \frac{1}{1!} P^{(1)}(l) & P(l) \end{pmatrix} $ $

and so forth. Generally,

$ $ R = \begin{pmatrix} P(l) & 0 & \cdots & 0 & 0 \ \frac{1}{1!} P^{(1)}(l) & P(l) & \cdots & 0 & 0 \ \frac{1}{2!} P^{(2)}(l) & \frac{1}{1!} P^{(1)}(l) & \cdots & 0 & 0 \ \vdots & \vdots & \ddots & \vdots & \vdots \ \frac{1}{(k-1)!} P^{(k-1)}(l) & \frac{1}{(k-2)!} P^{(k-2)}(l) & \cdots & \frac{1}{1!} P^{(1)}(l) & P(l) \end{pmatrix} $ $

is an $ nk×nk$ matrix.

I prefer a simple and understandable way and for that I thought to start with a zero matrix $ R$ of dimensions $ nk×nk$ and then with two "for" loops to full the initial zero matrix, putting the corresponding derivative which is needed. I’m not sure in what should go as my statement in "for" loops. I found other questions which were similar but more complicated and specific. Any help appreciated, thank you.

A cache has 64K lines where each line can store 8 blocks of the memory at a time

A cache has 64K lines where each line can store 8 blocks of the memory at a time. If the size of the memory is 2GB and block size is 4 Bytes, then which cache line is supposedly be holding the memory block with number "256" if cache supports Direct Mapping. Also compute total number of blocks this memory has and total number of blocks the cache in question can store at a time.