HelPHP

install_blocks.php

To call from CLI : php install_blocks.php /path/to/my/instance/ module_name

Table of Contents

Functions

block_definition_is_valid()  : bool
Checks that the field definitions of a block declaration are themselves valid JSON.
install_blocks()  : mixed

Functions

block_definition_is_valid()

Checks that the field definitions of a block declaration are themselves valid JSON.

block_definition_is_valid(string $declaration) : bool

A block file (<Nom>.json) holds, in its block_data entry, a json field whose value is the list of the block's editor fields. That value is a JSON string stored inside JSON: escaping it one level too deep produces a file that reads fine as a whole but installs a block_data row whose json column cannot be decoded, so the editor builds an empty form.

Parameters
$declaration : string

content of the block's json file

Return values
bool

install_blocks()

install_blocks(mixed $instance_path) : mixed
Parameters
$instance_path : mixed
On this page

Search results