signmaker_ui
This Drupal block provides an interface to generate custom signs using the Signmaker application. It allows administrators to configure the sign generation process through block settings.
Overview
The Signmaker UI block embeds an iframe into the Drupal page, displaying the Signmaker application. This application enables users to create printable signs by selecting images from a specified directory and defining their layout within a bounding box. The block's configuration allows administrators to set the image directory based on a taxonomy term and define the bounding box coordinates.
Prerequisites
- The
mediamodule enabled. - A
field_refuse_typefield on themediaentity, containing allowed values for refuse types. - Directories in
files/signmaker/that correspond to the allowed values of thefield_refuse_typefield, each containing images and a background image.
Installation
- Enable the
signmaker_uimodule: Install and enable thesignmaker_uimodule in your Drupal site. - Ensure Signmaker Application is installed: Verify that the PHP Signmaker application is installed and functioning correctly as described in its documentation.
- Configure Media Types: Make sure that the media types that will be used have the
field_refuse_typefield with allowed values that correspond to directories infiles/signmaker/.
Configuration
- Place the Block: Navigate to the "Block layout" page (
/admin/structure/block) and place the "Signmaker Block" in a region of your choice. - Configure the Block:
- Type: Select the refuse type from the dropdown. This determines the directory from which images are loaded (
files/signmaker/{type}). The values from thefield_refuse_typefield on themediaentity are used to populate this dropdown. - Bounding Box of Images:
- Top: Percentage from the top of the background image.
- Right: Percentage from the right of the background image.
- Bottom: Percentage from the bottom of the background image.
- Left: Percentage from the left of the background image.
- Type: Select the refuse type from the dropdown. This determines the directory from which images are loaded (
Usage
Once the block is configured and placed, it will display an iframe containing the Signmaker application. Users can interact with the application within the iframe to create and generate signs.
Dependencies
- Drupal Core
- Media module
- The PHP Signmaker application (included)
Assets
signmaker_ui/signmaker_embed: A Drupal library that may contain additional CSS or JavaScript to enhance the iframe integration (not included in the provided code, so needs to be created if extra functionality is desired).
Notes
- Ensure the
files/signmaker/{type}directories exist and contain the necessary images and background. - Adjust the iframe's
widthandheightattributes to fit your layout. - Error handling is minimal; consider adding more robust validation and error reporting.
- The
signmaker_ui/signmaker_embedlibrary is not defined in the provided code. If you need client-side interactions or styling for the iframe, create this library. - The url parameter
rootis very important for the external application to function correctly.