Provide blocks which allow positioning content within them in layouts.

Overview

Mini layouts

Provide blocks which allow positioning content within them in layouts.

Backdrop Installation

  1. Install and enable the module as usual.
  2. Go to admin/structure/mini-layouts to create new mini layout blocks.
  3. Go to admin/structure/mini-layouts/manage/YOUR_BLOCK_MACHINE_NAME/configure-layout-blocks to add blocks to the mini layout.
  4. Add the mini layout block to your site through the layout UI

LICENSE

This project is GPL v2 software. See the LICENSE.txt file in this directory for complete text.

CURRENT MAINTAINERS

Comments
  • Should mini layouts come with custom

    Should mini layouts come with custom "mini layout" templates

    I think that this could be a really, really cool module and very useful.

    I wonder if it should come with some custom templates specifically mini-layouts.

    I think the most common use case for me with mini layouts, would be to simply divide a single block into multiple columns or multiple rows. All of the existing layouts are much more complicated that I would need.

    I recognize that I could use "Boxton" to divide a single block into 3 additional columns, but something about this feels a little wrong?

    I don't think that custom mini-layout templates would be required for release, they could be added later.

    Also, I realize that flexible layout templates might be an alternative and make it possible to only create a minimal number of mini-layout-templates. But, having a list a few simple options available might be nice.

    Maybe there should be three sections on the admin page.

    1. Standard Layout Templates
    2. Mini Layout Templates
    3. Flexible Layout Templates - with either a link or instructions on how to create your own templates.
    opened by stpaultim 16
  • Feedback and thoughts on stripping out theme classes

    Feedback and thoughts on stripping out theme classes

    The core Basis theme has in the layout.css file a declaration of height: 100vh to the .layout class selector.

    When nesting a layout inside another layout, it triggers the 100vh and causes some funky spacing to happen specifically on the Basis theme. (it is shoving the content below the mini layout off the screen...

    image

    Is it worth considering to strip out any classes that may be defined by the layout or will this cause additional (unforseen) issues?

    I can see benefits to leaving and stripping but I don't know the technical ramifications to offer a suggested route.

    opened by philsward 10
  • Some blocks should probably be prevented from being chosen inside a mini layout

    Some blocks should probably be prevented from being chosen inside a mini layout

    Should a mini layout block be able to embed itself? I see it available in the list. Should "Page title" be suppressed? What about "Main content page"? Maybe that's ok.

    opened by herbdool 10
  • Should it work out of the box or does it need extra styling?

    Should it work out of the box or does it need extra styling?

    I wondered whether this module would solve a particular use case I have so decided to do a test. The use case is to split the content in an existing layout between a sidebar (left) and main content block. I wanted to use field blocks for some fields in the sidebar

    1. I created a new site (1.22) in Lando and installed devel and mini_layouts
    2. I used devel to create lots of nodes
    3. I created a layout (regular) for posts using Boxton (no sidebars) called 'Articles'
    4. I created a flexible layout template for a single row with 2 columns (33%/67%)
    5. I created a mini layout using the template, added the context of 'Get node ID from path' with node/%
    6. I added main content to the 67% and the field:field_block:node-field_image to the sidebar
    7. In the regular layout for articles I removed main content and added the mini layout block in its place.

    This is what articles now look like: chrome_JAG074vcJA

    This is in Basis with no extra styling.

    Details

    layout.flexible.mini_content_sidebar.json

    {
        "_config_name": "layout.flexible.mini_content_sidebar",
        "name": "mini_content_sidebar",
        "title": "Mini Content Sidebar",
        "description": "Displays a sidebar next to the content in a mini layout",
        "rows": {
            "089793f2-3501-40ef-b800-d0d8a53c545b": {
                "contains": "region_4_8",
                "element": "div",
                "classes": "",
                "container": "container",
                "region_names": {
                    "region_0": {
                        "label": "Sidebar",
                        "name": "mini-sidebar",
                        "region_class_enable": 0,
                        "classes": ""
                    },
                    "region_1": {
                        "label": "Content",
                        "name": "mini-content",
                        "region_class_enable": 0,
                        "classes": ""
                    }
                }
            }
        }
    }
    

    layout.mini_layouts.mini_sidebar.json

    {
        "_config_name": "layout.mini_layouts.mini_sidebar",
        "path": "node/%",
        "name": "mini_sidebar",
        "block_title": "",
        "title": "Mini Sidebar",
        "description": "",
        "renderer_name": "standard",
        "module": "mini_layouts",
        "weight": 0,
        "storage": 2,
        "layout_template": "mini_content_sidebar",
        "disabled": false,
        "settings": {
            "title": "",
            "title_display": "default",
            "title_block": null
        },
        "positions": {
            "089793f2-3501-40ef-b800-d0d8a53c545b--0": [
                "974646cf-16a1-49ab-b400-f759186f9e16"
            ],
            "089793f2-3501-40ef-b800-d0d8a53c545b--1": [
                "d97bba9d-7f75-4ce7-992b-4364c8534726"
            ],
            "title": []
        },
        "contexts": [],
        "relationships": [],
        "content": {
            "974646cf-16a1-49ab-b400-f759186f9e16": {
                "plugin": "field:field_block:node-field_image",
                "data": {
                    "status": 1,
                    "module": "field",
                    "delta": "field_block",
                    "settings": {
                        "title_display": "default",
                        "title": "",
                        "style": "default",
                        "block_settings": [],
                        "contexts": [],
                        "label": "hidden",
                        "formatter": "image",
                        "formatter_settings": {
                            "image_style": "",
                            "image_link": "",
                            "image_float": "",
                            "image_load": "auto"
                        },
                        "delta_offset": 0,
                        "delta_limit": "",
                        "delta_reversed": 0,
                        "admin_label": "",
                        "admin_description": ""
                    },
                    "uuid": "974646cf-16a1-49ab-b400-f759186f9e16",
                    "style": {
                        "plugin": "default",
                        "data": {
                            "settings": {
                                "classes": ""
                            }
                        }
                    }
                }
            },
            "d97bba9d-7f75-4ce7-992b-4364c8534726": {
                "plugin": "system:main",
                "data": {
                    "status": 1,
                    "module": "system",
                    "delta": "main",
                    "settings": {
                        "title_display": "none",
                        "title": "",
                        "style": "default",
                        "block_settings": [],
                        "contexts": [],
                        "admin_label": "",
                        "admin_description": ""
                    },
                    "uuid": "d97bba9d-7f75-4ce7-992b-4364c8534726",
                    "style": {
                        "plugin": "default",
                        "data": {
                            "settings": {
                                "classes": ""
                            }
                        }
                    }
                }
            }
        }
    }
    
    

    layout.layout.article.json

    {
        "_config_name": "layout.layout.article",
        "path": "node/%",
        "name": "article",
        "title": "Article",
        "description": null,
        "renderer_name": "standard",
        "module": null,
        "weight": 0,
        "storage": 1,
        "layout_template": "boxton",
        "disabled": false,
        "settings": {
            "title": "",
            "title_display": "default",
            "title_block": null
        },
        "positions": {
            "header": [
                "9017c335-8a91-4fba-8426-38747f19780b",
                "d3883e89-ec40-4e4f-a200-afcf762560fa"
            ],
            "top": [
                "812f1b74-32c3-44e7-bf06-6be0d3375547",
                "f47addfc-0fcc-4100-a000-c87723d082ac"
            ],
            "content": [
                "33ac8271-3269-45a9-bc00-b01963f8bcb5"
            ],
            "bottom": [],
            "footer": [
                "2f556c71-41b4-41a1-ab05-5a652d828f9f"
            ],
            "title": []
        },
        "contexts": [],
        "relationships": [],
        "content": {
            "9017c335-8a91-4fba-8426-38747f19780b": {
                "plugin": "system:header",
                "data": {
                    "status": 1,
                    "module": "system",
                    "delta": "header",
                    "settings": {
                        "title_display": "default",
                        "title": "",
                        "style": "default",
                        "block_settings": {
                            "menu": "user-menu",
                            "logo": 1,
                            "site_name": 1,
                            "site_slogan": 1
                        },
                        "contexts": []
                    },
                    "uuid": "9017c335-8a91-4fba-8426-38747f19780b",
                    "style": {
                        "plugin": "default",
                        "data": {
                            "settings": {
                                "classes": ""
                            }
                        }
                    }
                }
            },
            "d3883e89-ec40-4e4f-a200-afcf762560fa": {
                "plugin": "system:main-menu",
                "data": {
                    "status": 1,
                    "module": "system",
                    "delta": "main-menu",
                    "settings": {
                        "title_display": "none",
                        "title": "",
                        "style": "default",
                        "block_settings": {
                            "style": "dropdown",
                            "level": 1,
                            "depth": 0
                        },
                        "contexts": []
                    },
                    "uuid": "d3883e89-ec40-4e4f-a200-afcf762560fa",
                    "style": {
                        "plugin": "default",
                        "data": {
                            "settings": {
                                "classes": ""
                            }
                        }
                    }
                }
            },
            "812f1b74-32c3-44e7-bf06-6be0d3375547": {
                "plugin": "system:breadcrumb",
                "data": {
                    "status": 1,
                    "module": "system",
                    "delta": "breadcrumb",
                    "settings": {
                        "title_display": "default",
                        "title": "",
                        "style": "default",
                        "block_settings": [],
                        "contexts": []
                    },
                    "uuid": "812f1b74-32c3-44e7-bf06-6be0d3375547",
                    "style": {
                        "plugin": "default",
                        "data": {
                            "settings": {
                                "classes": ""
                            }
                        }
                    }
                }
            },
            "f47addfc-0fcc-4100-a000-c87723d082ac": {
                "plugin": "system:page_components:title_combo",
                "data": {
                    "status": 1,
                    "module": "system",
                    "delta": "page_components",
                    "settings": {
                        "title_display": "default",
                        "title": "",
                        "style": "default",
                        "block_settings": [],
                        "contexts": [],
                        "title_tag": "h1",
                        "title_classes": "page-title",
                        "tab-type": "both",
                        "tab_type": "both"
                    },
                    "uuid": "f47addfc-0fcc-4100-a000-c87723d082ac",
                    "style": {
                        "plugin": "default",
                        "data": {
                            "settings": {
                                "classes": ""
                            }
                        }
                    }
                }
            },
            "33ac8271-3269-45a9-bc00-b01963f8bcb5": {
                "plugin": "mini_layouts:mini_sidebar",
                "data": {
                    "status": 1,
                    "module": "mini_layouts",
                    "delta": "mini_sidebar",
                    "settings": {
                        "title_display": "none",
                        "title": "",
                        "style": "default",
                        "block_settings": [],
                        "contexts": [],
                        "admin_label": "",
                        "admin_description": ""
                    },
                    "uuid": "33ac8271-3269-45a9-bc00-b01963f8bcb5",
                    "style": {
                        "plugin": "default",
                        "data": {
                            "settings": {
                                "classes": ""
                            }
                        }
                    }
                }
            },
            "2f556c71-41b4-41a1-ab05-5a652d828f9f": {
                "plugin": "system:powered-by",
                "data": {
                    "status": 1,
                    "module": "system",
                    "delta": "powered-by",
                    "settings": {
                        "title_display": "default",
                        "title": "",
                        "style": "default",
                        "block_settings": [],
                        "contexts": []
                    },
                    "uuid": "2f556c71-41b4-41a1-ab05-5a652d828f9f",
                    "style": {
                        "plugin": "default",
                        "data": {
                            "settings": {
                                "classes": ""
                            }
                        }
                    }
                }
            }
        },
        "conditions": [
            {
                "plugin": "node_type",
                "data": {
                    "settings": {
                        "bundles": [
                            "post"
                        ],
                        "load_condition_nojs": "Load condition"
                    }
                }
            }
        ]
    }
    
    type - question 
    opened by yorkshire-pudding 9
  • Release?

    Release?

    How close do we think this is to release?

    I see that most of the reported bugs have been squashed. I just did some light experimenting and it seems to work as advertised.

    I have a feeling that this would get quite a bit of use quite quickly and hopefully additional feedback, once it is released.

    opened by stpaultim 5
  • Tweak user interface

    Tweak user interface

    Hi @docwilmot,

    this module is a great enhancement for the core layout system. :+1:

    I've noticed some room for improvement in the UI: the icons aren't very helpful:

    mini-layout-icons

    These caused me some head-scratching - "heck, what will these look like?" :smirk: Not sure, how much effort it would be to add custom icons, and if it's worth it.

    Another thing I've noticed is that the layouts this module ships with use both classes, "container" and "container-fluid" - to my knowledge these classes are mutually exclusive (fixed width vs. flexible width). (Something that's also wrong in core templates, but that's another issue.)

    mini-layout-both-classes

    In real life it's more likely that people construct their own (flexi) templates, anyway, so both findings aren't big problems.

    opened by indigoxela 4
  • ERROR - Call to undefined function mini_layouts_admin_configure_validate()

    ERROR - Call to undefined function mini_layouts_admin_configure_validate()

    @docwilmot - I just installed the current dev branch of Mini-Layouts into a fresh site and am getting this fatal error:

    Call to undefined function mini_layouts_admin_configure_validate()

    Steps to recreate:

    1. Start with a fresh site and enabled Mini-Layouts (main branch)
    2. Create a mini-layout with one of the new Mini Layout templates
    3. Save mini-layout

    This triggers the above error. Here is a screenshot from immediately before error:

    Screenshot from 2021-12-14 20-38-19

    opened by stpaultim 4
  • Mini-layout Title is required

    Mini-layout Title is required

    The form to create a mini-layout does not require a title. However, without a title a mini-layout can't be used.

    image

    But, when I go to add the mini-layout block, it is visible but not usable.

    image

    opened by stpaultim 4
  • PHP 7.4 Errors on save

    PHP 7.4 Errors on save

    When saving a mini-layout using PHP 7.4, the following errors are presented:

    Notice: Undefined property: MiniLayout::$contexts in MiniLayout->save() (line 58 of /home/user/public_html/t/backdrop1.modules/mini_layouts/layout.mini_layouts.class.inc).
    Warning: Invalid argument supplied for foreach() in MiniLayout->save() (line 58 of /home/user/public_html/t/backdrop1.modules/mini_layouts/layout.mini_layouts.class.inc).
    Notice: Undefined property: MiniLayout::$path in MiniLayout->save() (line 71 of /home/user/public_html/t/backdrop1.modules/mini_layouts/layout.mini_layouts.class.inc).
    Notice: Undefined property: MiniLayout::$contexts in MiniLayout->save() (line 84 of /home/user/public_html/t/backdrop1.modules/mini_layouts/layout.mini_layouts.class.inc).
    Notice: Undefined property: MiniLayout::$contexts in MiniLayout->save() (line 102 of /home/user/public_html/t/backdrop1.modules/mini_layouts/layout.mini_layouts.class.inc).
    Warning: Invalid argument supplied for foreach() in MiniLayout->save() (line 102 of /home/user/public_html/t/backdrop1.modules/mini_layouts/layout.mini_layouts.class.inc).
    Warning: Invalid argument supplied for foreach() in Layout->__construct() (line 246 of /home/user/public_html/t/backdrop1.core/modules/layout/includes/layout.class.inc).
    

    Switching back to PHP 7.3 removes the errors.

    Specifically saving a mini-layout at a path such as:

    https://site.com/admin/structure/mini-layouts/manage/layout_name/configure-layout-blocks
    
    opened by philsward 4
  • Running `MiniLayoutsBlockTestCase` leads to fatal error

    Running `MiniLayoutsBlockTestCase` leads to fatal error

    Steps to reproduce

    Enable simpletest and run MiniLayoutsBlockTestCase. (Backdrop 1.22.0 clean install)

    Warning: include_once(/Users/alejandrocremaschi/Sites/localhost/bd120/modules/mini_layouts/tests/block.test): failed to open stream: No such file or directory in include_once() (line 173 of /Users/alejandrocremaschi/Sites/localhost/bd120/core/modules/simpletest/simpletest.module).
    Warning: include_once(): Failed opening '/Users/alejandrocremaschi/Sites/localhost/bd120/modules/mini_layouts/tests/block.test' for inclusion (include_path='.:/Applications/MAMP/bin/php/php7.4.21/lib/php') in include_once() (line 173 of /Users/alejandrocremaschi/Sites/localhost/bd120/core/modules/simpletest/simpletest.module).
    Error: Class 'MiniLayoutsBlockTestCase' not found in simpletest_run_tests() (line 174 of /Users/alejandrocremaschi/Sites/localhost/bd120/core/modules/simpletest/simpletest.module).
    Notice: Undefined property: stdClass::$direction in template_preprocess_maintenance_page() (line 2895 of /Users/alejandrocremaschi/Sites/localhost/bd120/core/includes/theme.inc).
    

    Additional information

    ~~BackdropWebTest::setUp() does not take any arguments. The MiniLayoutsBlockTestCase:setUp() method invokes parent::setUp('block_test');, trying to enable block_test, which is never enabled.~~

    [EDIT: actually BackdropWebTest::setUp() does take arguments, retrieved with func_get_args();]

    opened by argiepiano 3
  • Improve display of block ID

    Improve display of block ID

    I just opened up a mini-layout for the first time in a while and found the display of the block ids a bit jarring.

    image

    I don't have specific ideas yet for improvement, but will try to think of something constructive to suggest and/or to work on a PR sometime soon.

    opened by stpaultim 3
  • Fix permissions

    Fix permissions

    This module's hook_permission() provides a administer blocks permission, which is already provided by core. We should either change this to a administer mini layout blocks permission or delete that implementation. If we delete, then the administer blocks permission will be the sole access control to creating and configuring Mini layouts. Are there situations where a user should have administer blocks but not be able to create a Mini block?

    opened by docwilmot 0
  • Add/change classes on the Layout when it is used as a mini-layout.

    Add/change classes on the Layout when it is used as a mini-layout.

    When I use the moscone layout as a mini-layout inside a page that also uses the moscone layout, selectors affecting my outer layout are also (inadvertently) affecting my inner one, because they have the exact same classes: layout--moscone layout

    Though it is possible that I can un-do all the unwanted styling added by adding the selector .layout, It's a lot of extra work.

    If the mini-layouts used different classes, maybe something like mini-layout--moscone mini-layout then I wouldn't need to un-do all the styles intended for my page layout.

    Is there a use-case where styles intended for the page are also intended for a block? It's possible, but I doubt it's 80%. Please weigh in here if you have such a use-case!

    pr - needs code review pr - needs testing status - has pull request type - feature request 
    opened by jenlampton 1
  • [UX] Add

    [UX] Add "Mini-layout:" to beginning of block description.

    My instinct every time is to type "mini" into the block search, expecting that will filter my block list to show all mini layouts. I think it would be helpful to include this text in the block description by default, so that people don't need to add it to every mini-layout manually.

    Screen Shot 2022-11-21 at 11 01 28 AM pr - needs code review pr - needs testing status - has pull request type - task 
    opened by jenlampton 0
  • Removing a

    Removing a "context from path" creates errors

    Steps to reproduce

    1. Create a mini layout and add "Context from path" for example node/%. 👍🏽
    Screen Shot 2022-06-01 at 6 25 01 PM
    1. Click Remove. You get (strangely):
    Screen Shot 2022-06-01 at 6 25 34 PM
    1. Click "Remove" again. The context seems to be removed 👍🏽
    2. Click Save. You get:
    Screen Shot 2022-06-01 at 6 26 47 PM
    opened by argiepiano 2
  • Better explain what this module can do in the README

    Better explain what this module can do in the README

    Currently there's "Provide blocks which allow positioning content within them in layouts."

    I don't think this really explains the power of this module. As a module maintainer I'm also always struggling with the module description and / or documentation, so maybe we find a volunteer to extend the description.

    Possibly @stpaultim? :wink:

    type - documentation 
    opened by indigoxela 1
Releases(1.x-1.0.1)
Owner
Backdrop CMS contributed projects
Join the group at https://github.com/backdrop-ops/contrib to add your own!
Backdrop CMS contributed projects
Converts any PocketMine-MP 3.0 extended blocks into PM4 native blocks!

ExtendedBlocksConverter Converts any PocketMine-MP 3.0 extended blocks into PM4 native blocks! Yes, you heard right, this plugin can convert any lefto

Covered123 6 Jun 4, 2022
Installable com_content/category overrides with configuration settings to create card layouts

Installable com_content/caregory overrides with configuration settings to create card layouts. Uses default bootstrap css only.

Brian Teeman 10 Jan 5, 2023
A Magento 2 module that allows for creating discrete PDP (Product Detail Pages) page layouts for customers landing on the site from a PPC (Pay Per Click) link/ad by allowing routing to the same pages using a `/ppc/` prefix in the URL path.

A Magento 2 module that allows for creating discrete PDP (Product Detail Pages) page layouts for customers landing on the site from a PPC (Pay Per Click) link/ad by allowing routing to the same pages using a `/ppc/` prefix in the URL path.

null 16 Nov 11, 2022
Allow SVG images to be used in Magento CMS blocks and pages via the TinyMCE Wysiwyg Editor.

Hyvä Themes - SVG support for the Magento CMS Wysiwyg Editor Allow SVG images to be used in CMS blocks and pages via the TinyMCE Wysiwyg Editor. hyva-

Hyvä 14 Dec 15, 2022
Silverstripe module allowing editors to create newsletters using elemental blocks and export them to a sendy instance

Silverstripe Sendy Silverstripe module allowing editors to create newsletters using elemental blocks and export them to a sendy instance. Introduction

Syntro Opensource 4 Apr 20, 2022
A Magento 1.x module which facilitates automatic purging of static assets from HTTP caches such as browser cache, CDN, Varnish, etc using best practices outlined within the HTML5 boilerplate community.

Magento Cachebuster Cachebuster is a Magento module which facilitates automatic purging of static assets from HTTP caches such as browser cache, CDN,

Gordon Knoppe 129 Apr 1, 2022
KodExplorer is a file manager for web. It is also a web code editor, which allows you to develop websites directly within the web browser.

KodExplorer is a file manager for web. It is also a web code editor, which allows you to develop websites directly within the web browser.

warlee 5.5k Feb 10, 2022
Formcreator is a plugin which allow creation of custom forms of easy access

Formcreator is a plugin which allow creation of custom forms of easy access. At the same time, the plugin allow the creation of one or more tickets when the form is filled.

GLPI plugins 135 Dec 22, 2022
PHP Unoconv - An Object Oriented library which allow easy to use file conversion with Unoconv.

An Object Oriented library which allow easy to use file conversion with Unoconv. Install The recommended way to install PHP-Unoconv is thr

Alchemy 69 Dec 3, 2022
GDPR compliant TYPO3 content elements which work great with PIWIK Consent Manager.

PIWIK Consent Manager TYPO3 extension PIWIK Consent Manager integration in order to make TYPO3 content elements GDPR compliant. You can click on the i

null 6 Aug 8, 2022
A plugin to add more blocks to PocketMine

This plugin aims to add all blocks not included in PocketMine. As of right now the ExtendedBlocks plugin is required to add blocks with IDs above 255.

xSuper 26 Dec 19, 2022
Highlight code blocks with league/commonmark and Shiki

Highlight code blocks with league/commonmark and Shiki This package contains a block renderer for league/commonmark to highlight code blocks using Shi

Spatie 55 Aug 27, 2022
A minimal library that defines primitive building blocks of PHP code.

Jungi Common A minimal library that defines primitive building blocks of PHP code. It combines the advantages of functional and object-oriented progra

Piotr Kugla 28 Jul 15, 2022
A minimal library that defines primitive building blocks of PHP code.

A minimal library that defines primitive building blocks of PHP code. It combines the advantages of functional and object-oriented programming. All of this makes code easier to understand and less prone to errors.

Jungi 28 Jul 15, 2022
A quick naked theme to demonstrate how easy it is to support Gutenberg using ACF blocks

ACF Gutenberg Demo Theme A quick naked theme to demonstrate how easy it is to support Gutenberg using ACF blocks demo.mp4 Files I have found a useful

Stirtingale 1 Oct 28, 2021
PocketMine-MP Plugin for converting items & blocks name to your language.

ConvertName PocketMine-MP Plugin for converting items & blocks name to your language. Usage Due to license issue, I don't put the language files direc

null 6 Aug 25, 2022
This plugin adds 95% of 1.16 blocks & items and their functionality

INether This plugin adds 95% of 1.16 blocks & items and their functionality Implemented blocks Ancient Debris All types of Basalt Crimson & Warped Fun

null 34 Dec 7, 2022
Magento 2 Module to add simple image resizing capabilities in all blocks and .phtml templates

Magento 2 Image Resizer Magento 2 Module to add simple image resizing capabilities in all blocks and .phtml templates Installation $ composer require

Stämpfli AG 88 Apr 18, 2022