Skip to content
Snippets Groups Projects
Commit 7f13a739 authored by Lucas Hedding's avatar Lucas Hedding Committed by Lucas Hedding
Browse files

Issue #3041918 by heddn, qymanab: Add examples to file_blob plugin

parent 84cdd8e2
No related branches found
No related tags found
No related merge requests found
...@@ -13,6 +13,60 @@ use Symfony\Component\DependencyInjection\ContainerInterface; ...@@ -13,6 +13,60 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
/** /**
* Copy a file from a blob into a file. * Copy a file from a blob into a file.
* *
* The source value is an indexed array of two values:
* - The destination URI, e.g. 'public://example.txt'.
* - The binary blob data.
*
* Available configuration keys:
* - reuse: true
*
* Examples:
*
* @code
* uri:
* plugin: file_blob
* source:
* - 'public://example.txt'
* - blob
* @endcode
*
* A basic configuration.
*
* @code
* source:
* constants:
* destination: public://images
* process:
* destination_blob:
* plugin: callback
* callable: base64_decode
* source:
* - blob
* destination_basename:
* plugin: callback
* callable: basename
* source: file_name
* destination_path:
* plugin: concat
* source:
* - constants/destination
* - @destination_basename
* uri:
* plugin: file_blob
* source:
* - @destination_path
* - @destination_blob
* @endcode
*
* In some instances, it may be necessary to manipulate values before they can
* be processed by this plugin. This is because this plugin takes a binary blob
* and saves it as a file. In many cases, as in this example, the data is base64
* encoded and should be decoded first. In destination_blob, the incoming data
* is decoded from base64 to binary. The destination_path element is
* concatenating the base filename with the destination directory set in the
* constants to create the final path. The resulting values are then referenced
* as the source of the file_blob plugin.
*
* @MigrateProcessPlugin( * @MigrateProcessPlugin(
* id = "file_blob" * id = "file_blob"
* ) * )
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment