Download the PHP package purplespider/silverstripe-visual-block-picker without Composer

On this page you can find all versions of the php package purplespider/silverstripe-visual-block-picker. 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 silverstripe-visual-block-picker

Silverstripe Visual Block Picker

Replaces Elemental's "Add block" popover with a modal that shows each block as a screenshot card with its name and description, organised into groups. The search box still works, and now matches descriptions and group names too.

Screenshots are matched by filename, so adding one is drag-and-drop — no code, no config. Blocks without a screenshot fall back to an icon tile, so the picker is useful straight away.

Requirements

Versions

Module Silverstripe CMS Elemental Branch
2.x 6 6 main
1.x 5 5 1

This is the 2.x branch, for CMS 6. Composer picks the right major for your project automatically.

Installation

Then flush: visit any page with ?flush=1, or run sake db:build --flush.

That's it — there's no build step and nothing to configure to get started.

Adding screenshots

Create public/images/blocks/ and drop in an image named after each block class:

Flush, and the cards appear. Recognised extensions in order of preference: webp, png, jpg, jpeg, svg. Cards use a 16:9 area with object-fit: cover, so landscape images around 640×360 work well.

If two block classes in different namespaces share a short name, use the fully qualified name with hyphens instead of backslashes. This form is checked first, so it wins:

The module also looks in themes/<theme>/dist/images/blocks/. If you use that location, add it to your theme's extra.expose in composer.json and run composer vendor-expose, or the images won't be reachable. public/images/blocks/ needs no exposing, which is why it's the default.

Grouping blocks

Groups render in the order configured, and cards render in the order you list them, so each group can lead with the block people reach for most.

Anything you don't list falls into a trailing group named by ungrouped_title, sorted alphabetically. Configure no groups at all and the picker renders one flat grid with no headings.

Per-page restrictions (allowed_elements and friends) keep working untouched — the picker joins its config onto the list Elemental has already filtered for the page being edited.

Configuration reference

All options sit on PurpleSpider\VisualBlockPicker\Services\BlockPickerConfigProvider unless noted.

Option Default Purpose
groups [] Ordered list of {title, blocks}
ungrouped_title 'Other' Heading for unlisted blocks. Empty string to drop it
exclude_classes [] Block classes to hide from the picker entirely
show_title_icons false Show each block's Elemental icon beside its name
screenshot_dirs † ['public/images/blocks'] Where to look, first match wins
screenshot_extensions † webp, png, jpg, jpeg, svg Extensions to probe, in order

† on PurpleSpider\VisualBlockPicker\Services\ScreenshotResolver

show_title_icons only controls the small icon next to the name. The icon tile shown for blocks with no screenshot always renders.

Descriptions

Descriptions come from each block's class_description:

Elemental's older $description static is deprecated and is not read.

For blocks you don't own, you can set class_description from YAML — but note a translation always wins over it, and some modules ship one (elemental does for ElementContent). If YAML seems to have no effect, override the translation instead in app/lang/en.yml:

Check which you're getting with singleton($class)->i18n_classDescription().

Caching

The payload is cached and rebuilt on ?flush. If you add a screenshot or change a group and see no difference, flush. Caching isn't optional here: Silverstripe builds this config on every CMS page load.

Note that flushing from the CLI won't always clear it for the browser — PHP-FPM and CLI have separate opcaches. Use ?flush=1 in the browser if a change doesn't show.

Development

The client assets in client/dist are hand-written and committed deliberately — there is no webpack step. They use the globals Silverstripe's admin bundle already exposes (React, Reactstrap, Injector), so the module participates in the CMS's React tree without a build.

Licence

BSD-3-Clause


All versions of silverstripe-visual-block-picker with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
silverstripe/framework Version ^6.0
silverstripe/admin Version ^3.0
dnadesign/silverstripe-elemental Version ^6.0
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 purplespider/silverstripe-visual-block-picker contains the following files

Loading the files please wait ...