Download the PHP package donbuche/layout_builder_import_export without Composer

On this page you can find all versions of the php package donbuche/layout_builder_import_export. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package layout_builder_import_export

Layout Builder Import Export

Version 1.0.0

A custom Drupal module for exporting and quick-editing the editorial text content of Layout Builder block_content entities and their paragraph trees.


Requirements

Requirement Version
Drupal 10.x or 11.x
PHP 8.1 or higher
Drupal core: layout_builder enabled
Drupal core: block_content enabled
Drupal core: content_translation enabled (for translation workflow)

The module traverses entity_reference_revisions fields to reach nested paragraph entities. The paragraphs contrib module is not declared as a dependency because the traversal is performed via Drupal's core field API and works with any entity that uses that field type.


Installation


Repository clean-up before committing

Two files must be removed before pushing to the repository:

Add temp/ to the module's .gitignore to prevent accidental future commits:


Architecture

BlockTextExporter service

layout_builder_import_export.block_text_exporter

Injected into both the controller and the form. This is the only place that defines:

Any change to what gets exported must be made only here.


Usage

1. Quick Edit tab (primary workflow)

Navigate to /admin/content/block, open any block, and click the Quick Edit tab alongside Edit and Translate.

Three sub-modes are available as vertical tabs:

Fields mode (default)

One input per text field, grouped by paragraph entity. Formatted text fields (text_long, text_with_summary) render with the full CKEditor 5 editor, giving access to configured styles and image upload. Link URI fields for internal nodes use Drupal's native entity autocomplete. Plain string fields render as standard textfields.

Text mode (AI translation)

Outputs a numbered plain-text format optimised for AI translation:

A ready-to-use AI prompt is displayed above the textarea. Copy the content, send to an AI assistant with the prompt, paste the response back (the module strips markdown code fences automatically), and click Save Text.

JSON mode

Full export document for scripting or batch processing. The structure includes item IDs, langcode, and new_value placeholders. See the endpoint section below for the document format.


Language / translation

There is no manual language selector. The active language is determined by Drupal's URL language negotiation:

Recommended translation workflow:

  1. Create the block translation via Drupal's native Translate tab.
  2. Navigate to the block list in the target language (e.g. /es/admin/content/block).
  3. Open Quick Edit — the form is now in Spanish context.
  4. Edit fields or use the Text/JSON tab with an AI assistant.
  5. Save. Paragraph translations are created automatically when they do not exist.

Prerequisite: paragraph text fields must be marked as Translatable in /admin/config/regional/content-language. The form warns before saving if it detects non-translatable fields.


2. JSON export endpoint (read-only)

Example response:

Item ID formats:

Format Used for
entity_type:id:rev:field:delta All text fields
entity_type:id:rev:field:delta:property Link fields (uri or title)

3. Debug endpoint (development only)

Returns the complete field structure of the block, including system fields, computed fields, and referenced entities one level deep. Use this to diagnose why a specific field is missing from the normal export. Remove or restrict access to this endpoint in production if sensitive field data is a concern.


Field filtering rules

Applied in order by BlockTextExporter:

  1. Field type — Only string, string_long, text, text_long, text_with_summary, and link fields are considered.

  2. Naming convention — Fields not prefixed with field_ are always excluded (Drupal base fields: langcode, status, parent_id, etc.).

  3. Explicit exclusion list — Fields excluded despite using a text type: field_attribute_class, field_attribute_id, field_attribute_rel, field_attribute_target, field_html_tag, field_accordion_behavior.

  4. Pattern exclusion — Any field whose name contains icon is excluded.

field_custom_attributes is not excluded because it may contain accessibility strings (e.g. aria-description="See all services") that are genuine editorial content. The AI prompt instructs the assistant to translate only attribute values, not attribute names, and to skip boolean values.

To add or remove exclusions, edit the constants in src/Service/BlockTextExporter.php.


Paragraph traversal depth

MAX_DEPTH = 3 (defined in BlockTextExporter). Increasing it risks issues with circular references in unusual paragraph configurations.


Security


Planned features


All versions of layout_builder_import_export with dependencies

PHP Build Version
Package Version
Requires php Version ^8.4
drupal/core Version ^11
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package donbuche/layout_builder_import_export contains the following files

Loading the files please wait ...