Download the PHP package bummzack/page-blocks without Composer

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

Page-Blocks for SilverStripe

IMPORTANT: This module is currently work-in-progress and is subject to major changes or refactoring. Here's the current TODO.

Please feel free to create pull-requests (especially for things in the TODO) or open issues with new ideas/requests.

What is this?

Page-Blocks is a Module that adds content to a SilverStripe page in a modular way. Ever had a client that wanted some text, followed by a gallery, some more text and then a video?

You can do some of these things by allowing the user to insert videos and images directly into the content-editor (TinyMCE), but you'll lose control over the website-design.

The goal of this module is to allow flexible page-designs, while giving you full control over the design of the content. It's also great for single-page websites.

This module should be light-weight and extensible. We provide the backend integration, while you have to care about the frontend (we won't ship another gallery module). This isn't a all-round carefree package, but we provide some basic templates and (hopefully) a good documentation.

Requirements

Mandatory

Optional (for a better experience)

These will be installed when installing the module via composer.

Installation

Use composer to install the module and all its dependencies.

composer require bummzack/page-blocks

If the above fails (composer complains about no matching packages when resolving requirements), then open up your composer.json file and add "minimum-stability": "dev" in the "root" of the JSON structure:

{
    "minimum-stability": "dev",
    ... 
}

After doing so, run the composer require command again and it should successfully install the module and all requirements.

If you don't use composer, make sure you install at least the modules that are listed as "mandatory" under Requirements

After installing, make sure you rebuild the database and flush the cache (dev/build?flush=1).

Important: Your CMS won't change at all after the installation. You first have to configure the module. Read on.

Configuration

The most important step is to add the PageBlocks extension to your page-types. It's up to you to decide which page-type should have blocks. For example you could create a custom Page named BlockPage. Here's a complete class listing for such a page:

Yep, that's it. Now you can create a new BlockPage in the CMS and add content-blocks to it. Of course you can also apply the extension via config.yml (even to existing page-types). Here's how you would add blocks to your Page class:

Overriding some of the defaults

To disable the "Publish Page & Blocks" Button in the CMS:

To customize the video-block aspect-ratios and player appearance. In this example we configure several aspect-ratios to choose from and set the player controls to red (only works with the vimeo player).

Specify which blocks can be added to a page

Imagine that there are two different Page-types. One page can only have Text- and Video-Blocks attached, the other page should only have Text- and Image-Blocks as valid options.

The best way to do so is to set the allowed_blocks config for your page.

If you need to set the allowed-blocks on a per-GridField basis, then use GridFieldConfig_BlockEditor::setAllowedBlocks which lets you specify the blocks that can be created.

Here's an example, where we limit the allowed blocks to just ImageBlock and TextBlock:

Templates

There are example templates for all the blocks available in the page-blocks/templates/Blocks directory. Feel free to copy the entirey Blocks directory to your themes/<themename>/templates or into your mysite/templates folder so that you can customize them to your liking.

To output your blocks in your page templates, do something like this:

There's also an include file you can use to output all the blocks. It can be found at page-blocks/templates/Includes/Blocks.ss.

Adding a Block to multiple Pages

Use the provided VirtualBlock to create virtual versions of an existing block.

Writing custom Blocks

Writing your custom Blocks is super easy (just subclass Block). Let's assume you want to create some sort of "Embed-Block" that allows you to embed external content via iframe or similar:

Then also create a matching template (named EmbedBlock.ss) in your template folder. The template code could look like this:

Then just run dev/build?flush=1 and you're set. The EmbedBlock should be available in the CMS via dropdown.

Screenshots


All versions of page-blocks with dependencies

PHP Build Version
Package Version
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 bummzack/page-blocks contains the following files

Loading the files please wait ....