Download the PHP package winter/wn-blocks-plugin without Composer

On this page you can find all versions of the php package winter/wn-blocks-plugin. 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 wn-blocks-plugin

Blocks Plugin

Blocks Plugin

MIT License

Provides a "block based" content management experience in Winter CMS

NOTE: This plugin is still in development and is likely to undergo changes. Do not use in production environments without using a version constraint in your composer.json file and carefully monitoring for breaking changes.

Installation

This plugin is available for installation via Composer.

After installing the plugin you will need to run the migrations and (if you are using a public folder) republish your public directory.

NOTE: In order to have the actions support function correctly, you need to load /plugins/winter/blocks/assets/dist/js/blocks.js after the Snowboard framework has been loaded.

Core Concepts

Blocks

This plugin manages the concept of "blocks" in Winter CMS. Blocks are self contained pieces of structured content that can be managed and rendered in a variety of ways.

Blocks can be provided by both plugins and themes and can be overridden by themes.

Actions

This plugin also introduces the concepts of "actions"; a way to define and execute client side actions that can be triggered by various events. Currently, actions are only defined in the $/winter/blocks/meta/actions.yaml file and must exist as a function on the window.actions object in the frontend keyed by the action's identifier that receives the data object as the first argument and (optionally) the event object that triggered the action as the second argument.

NOTE: This is very much a WIP API and is subject to change. Feedback very much welcome here for ideas around how to register, manage, extend, and provide actions to the frontend.

Tags

Blocks may have one or more tags, which is a way of defining and grouping blocks. For example, you may have a Gallery block which allows only "image" tagged blocks to be used, or a container block which allows all "content" tagged blocks but does not allow another "container" tagged block within.

Tags are defined in the blocks, and can be used to filter the available blocks in the Blocks form widget.

Registering Blocks

Themes can have their blocks automatically registered by placing .block files in the /blocks folder and subfolders.

Plugins can register blocks by providing a registerBlocks() method in their Plugin.php file. The method should return an array of block definitions in the following format:

Block Definition

Blocks are defined as .block files that consist of 2 to 3 parts:

When there are two parts, they are the Settings (YAML) & Markup (Twig) sections.

The following property values (name, description, etc) can be defined in the Settings (YAML) section of the .block files:

Blocks can use components in them, although they may face lifecycle limitations with complex AJAX handlers similar to component support in partials.

Fields and Configuration

Blocks may define both fields as well as a config property in the Settings. Both of these parameters accept a form schema, but serve different purposes. In general, fields should contain the fields that actually fill in the content of the block, whereas the config should contain the fields that define the appearance or structure of the block itself. Fields are displayed within the block in the blocks form widget and configuration is displayed in an Inspector which can be shown by clicking on the "cogwheel" icon of a block in the blocks form widget.

For example, let's say you have a Title block which can display a heading tag in your content. You may optionally want to align it to left, center or right, and define which heading tag to use. The best practice would be to have a content field in the fields definition, because it's the actual content being displayed. The alignment and tag would become part of the config configuration.

Example:

Using the blocks FormWidget

In order to provide an interface for managing block-based content, this plugin provides the blocks FormWidget. This widget can be used in the backend as a form field to manage blocks.

The blocks FormWidget supports the following additional properties:

Those properties allow you to limit the block types that can be added to a specific instance of the widget, which can be very helpful when building "container" type blocks that need to avoid including themselves or only support a specific set of blocks as "children".

Examples

The button_group block type only allows a button block to be added to it:

The container block type allows any block called title, or has a tag of content, to be added to it:

The columns_two block type allows every block except for itself to be added to it:

Integration with the Winter.Pages plugin:

Include the following line in your layout file to include the blocks FormWidget on a Winter.Pages page:

Rendering Blocks

Using Twig

Twig functions are provided by this plugin for rendering blocks. You can then use the following Twig snippet to render the blocks data in your layout:

You can use it anywhere an expression is accepted:

If you need to render a single block, you can use the renderBlock function:

Using a partial

If you need to customize the rendering of blocks according to their group, you can use a special blocks.htm partial in your theme:

You can then use the following Twig snippet to render the block data in your layout:

Using PHP

Integrating with TailwindCSS / CSS Purging

If your theme uses CSS class purging (i.e. Tailwind), it can be useful to add the following paths to your build configuration to include the styles for any blocks defined by the theme or plugins.

Feedback

The Winter.Blocks is perfect for my block-based themes. I've been looking for something like this for a long time


All versions of wn-blocks-plugin with dependencies

PHP Build Version
Package Version
No informations.
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 winter/wn-blocks-plugin contains the following files

Loading the files please wait ...