承接 digitaledinge/contao-grid-ratio-widget 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

digitaledinge/contao-grid-ratio-widget

Composer 安装命令:

composer require digitaledinge/contao-grid-ratio-widget

包简介

Grid ratio widget for Contao Open Source CMS

README 文档

README

github version amount of downloads minimum php version

Description

Adds a backend widget to define uneven grid column ratios for element groups. The editor sets a column count (2–4) and drags a ruler to split the width; the value is stored as a ready-to-use fr list (e.g. 4fr 8fr) and rendered as the inline custom property --grid-cols on the group wrapper.

The widget is framework-independent (e.g. no Tailwind) and self-contained: Installing the bundle adds the field to the element_group content element and ships the matching frontend grid CSS.

How it works

  • Backend: an "Erweitertes Spaltenset" checkbox reveals the ratio field (sub-palette). The ruler snaps to twelfths, so 2/3/4 columns can be split evenly and in exact thirds/quarters. Percentages are shown; fr is stored.
  • Frontend: the bundle wraps the nested elements in <div class="grid-ratio" style="--grid-cols: 4fr 8fr"> and ships grid-ratio CSS (grid-template-columns: var(--grid-cols), stacked on mobile).

Installation

composer require digitaledinge/contao-grid-ratio-widget

Customization

The grid-ratio behavior is split into overridable Twig blocks, so you can switch parts off or reuse them elsewhere.

Resets

{# @Contao/content_element/element_group.html.twig #}

{% extends '@Contao/content_element/element_group.html.twig' %}

{# Reset the grid_ratio_attributes as they are embedded within _content_wrapper #}
{% block grid_ratio_wrapper_attributes %}{% endblock %}

{# Removing the styles within head #}
{% block grid_ratio_css %}{% endblock %}

Using within your template

To apply a stored value to your own element, add the attributes that will inject the --grid-cols variable in your CSS:

{% extends '@Contao/content_element/_base.html.twig' %}
{% use '@Contao/grid/grid_ratio_attributes.html.twig' %}

{# Adding attributes #}
{% set own_attributes = attrs().mergeWith(block('grid_ratio_attributes')) %}

{# Adding styles #}
{% add 'grid-ratio' to head %}
    <style>
        @media (width >= 768px) {
            .grid-ratio {
                display: grid;
                grid-template-columns: var(--grid-cols, 1fr);
            }
        }
    </style>
{% endadd %}

统计信息

  • 总下载量: 0
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 6
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: JavaScript

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-06-23

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固