Download the PHP package dnadesign/silverstripe-elemental-virtual without Composer

On this page you can find all versions of the php package dnadesign/silverstripe-elemental-virtual. 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-elemental-virtual

Silverstripe Elemental Virtual

CI

Introduction

This module extends Elemental so that a single content block can be shown on more than one page.

Instead of copying a block, you add a Virtual block to another page and point it at the original. The virtual block renders the original block's content, so you only need to edit the original once and every page that links to it is updated.

Requirements

Elemental Virtual Silverstripe CMS Elemental
3.x 6.x 6.x
2.x 5.x 5.x
1.x 4.x 3.x, 4.x

Installation

Then build the database and flush:

Usage

  1. Make a block available. Open the original block, go to the Settings tab and tick Available globally. You can only link to blocks that have this setting.
  2. Link to it from another page. On the other page, add a Virtual block and pick the original block from the Linked element dropdown.
  3. Publish. Publish both the original block and the page with the virtual block. If the original block isn't published, the virtual block shows a warning in the CMS and doesn't render on the live site.

To change the content, edit the original block. The virtual block has a "Click here to edit the original" link that takes you there.

Finding blocks in the dropdown

Each block has a Virtual Lookup Title. The Linked element dropdown shows and searches this title. It's regenerated every time the block is saved and looks like this:

That is the block's title, type, ID and the page it's on. A block without a title shows [no title], and a block that isn't on any page shows not currently in use. Both kinds are sorted to the bottom of the list.

You can see a block's lookup title on its Settings tab.

Which pages use a block?

When a block has virtual copies, the original block gets a Linked To tab that lists every page showing it. Blocks that are edited inline (inline_editable: true, the Elemental default) don't get this tab, because inline-editable blocks can't contain a GridField.

Deleting the original block

If you delete an original block that has virtual copies from the draft stage, the module keeps the content. It replaces the first virtual copy with a real copy of the original, choosing a published virtual copy if there is one. All other virtual copies are then pointed at the new block.

Configuration

Default "Available globally" setting

New blocks are not available globally by default. You can change this for all blocks or only for some block types:

This setting only applies to new blocks. To apply it to existing blocks, run the reset task. The task sets AvailableGlobally on every block, on both the draft and live stages, to the value configured for its class:

The task overwrites any changes editors have made by hand.

Dropdown label field

The Linked element dropdown uses VirtualLookupTitle for its labels and search. To use a different database field on BaseElement:

Customising the lookup title

To change the lookup title, add an extension to BaseElement that implements updateVirtualLinkedSummary:

Existing lookup titles change the next time each block is saved. Globally available blocks that don't have a lookup title yet get one on db:build.

Templates and front end

A virtual block renders the linked block's own template, wrapped in the DNADesign/Elemental/Layout/ElementHolder_VirtualLinked holder. The holder adds an element--virtual CSS class and uses the original block's anchor as its id. To change the wrapper markup, override that template in your theme.

Blocks that have their own controller actions, such as forms, also work through a virtual block. The module adds an element/$ID URL handler to ContentController. ElementVirtualLinkedController then sends those actions, and the redirects that follow them, to the page that shows the virtual block.

Translations

Translations are in lang/ and are managed with the usual Silverstripe i18n workflow. Pull requests for new languages are welcome.

Contributing

Please see CONTRIBUTING.md. To run the checks locally:


All versions of silverstripe-elemental-virtual with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
dnadesign/silverstripe-elemental Version ^6
silverstripe/tagfield Version ^4
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 dnadesign/silverstripe-elemental-virtual contains the following files

Loading the files please wait ...