Download the PHP package dennisprins/silverstripe-elemental-grid without Composer

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

Silverstripe CMS Elemental

Build Status Scrutinizer Code Quality codecov Silverstripe CMS supported module Version

Introduction

This module extends a page type to swap the content area for a list of manageable elements to compose a page out of rather than a single text field. Features supported:

The module provides basic markup for each of the elements but you will likely need to provide your own styles. Replace the $Content variable with $ElementalArea in your page templates, and rely on the markup of the individual elements.

For a more detailed overview of using this module, please see the User help guides.

Requirements

For a Silverstripe CMS 4.1 or 4.2 compatible version of this module, please see the 2.x or 3.x release line.

For a Silverstripe CMS 3.x compatible version of this module, please see the 1 branch, or 1.x release line.

Installation

The following YAML config will enable elements on every Page object, replacing the standard Content rich text field.

mysite/_config/elements.yml

In your page type layout template use $ElementalArea to render the elements to the page (in place of $Content).

Getting more elements

Note that this module comes by default with the base element and a "Content" element. If you need more, take a look at some other modules:

Silverstripe CMS supported content block modules

To learn more about Silverstripe CMS supported content block types see, Creating new blocks.

Examples of community built content block modules (not a comprehensive list - may not be updated for Elemental 4 yet)

Helpful modules

These modules can extend functionality, and make elemental more compatible with other approaches in Silverstripe CMS:

Configuration

Limit to specific page type

If you want to use elements alongside traditional page types, you can define an "empty" page type and assign the extension only to this type.

mysite/src/MyElementPage.php

mysite/_config/elements.yml

Migrating existing page content

You can use the MigrateContentToElement BuildTask that is provided to assist with migrating content from pages to elements. For more information on using this task refer to the content migration documentation.

Customize HTML and markup

The basic element area is rendered into the DNADesign/Elemental/Models/ElementalArea.ss template. This loops over each of the element controller instances. Each controller instance will render $ElementHolder which represents the element contained within a holder div. The wrapper div is the ElementHolder.ss template.

To customise the ElementEditor in the CMS you will need to use the Silverstripe CMS JS Injector to apply transformations to the necessary React components. See here for more information.

Limit allowed elements

You may wish to only enable certain elements for the CMS authors to choose from rather than the full set. This can be done according to various page types:

Likewise, you can exclude certain elements from being used.

Sharing elements between pages

By default the page to element relationship is a "has one", meaning you cannot share elements between pages. If this functionality is desired, you could take a look at the silverstripe-elemental-virtual module which helps to achieve this.

Defining your own elements

An element is as simple as a PHP class which extends DNADesign\Elemental\Models\BaseElement, and a template to go with it (unless you want it to use the default template). After you add the class, ensure you have rebuilt your database and reload the CMS.

In-line Editing

Elements can be edited in the CMS using an inline form where all your elements appear together. For elements that are more complex (e.g. use custom FormField classes) you can disable the in-line edit form by setting private static $inline_editable = false in your element class. A GridFieldDetailForm will be used to edit blocks that are not in-line editable. Alternatively as the CMS element editor is now React driven, in-line editing functionality can be added to by defining your own React components.

Note: The default is that all elements are in-line editable.

If in-line editing is not disabled, whilst not having a custom component defined, custom fields will not be rendered unless the field's schemaDataType is set See Framework's FormField definition.

After building your own React components and including them into the CMS, altering the applicable Element's PHP definition to use the new React component can be achieved by setting some protected properties of that class.

The above example was taken from silverstripe/elemental-bannerblock

Defining your own HTML

MyElement will be rendered into a MyElement.ss template with the ElementHolder.ss wrapper. Changing the holder template can be done via YAML, or by using a $controller_template on your subclass.

To customise existing block templates such as Content and Form templates, copy the relevant files from vendor/dnadesign/silverstripe-elemental/templates to your theme. When doing this, ensure you match the folder structure (PHP class namespace) to ensure that your new template version takes priority.

Note: The default set of elements follow the [BEM (Block Element Modifier])(http://getbem.com/) class naming convention, which allows developers to style individual parts of the DOM without unnecessarily nested CSS. Where possible, we encourage you to follow this naming system.

Position Helpers

In your BaseElement template you can use the following variables for additional logic or styling helpers. They behave in the same way traditional SS_Viewer methods work either returning a Boolean, String or a Int

  1. $First (boolean)
  2. $Last (boolean)
  3. $Pos (int)
  4. $TotalItems (int)
  5. $EvenOdd (string - 'even' or 'odd')

Style variants

Via YAML you can configure a whitelist of style variants for each BaseElement subclass. For instance, if you have dark and light variations of your content block you would enter the following in YAML in the format (class: 'Description'). The class will be added to the ElementHolder.

Disabling the default stylesheets

When installing this module, there may be a default set of CSS stylesheets that come to provide some examples for the various default element types for the front-end website.

You can disable this with YAML configuration:

Implementing search

The Elemental module comes with an indexer for Solr (via the silverstripe-fulltextsearch module). You can enable this index in your search engine to ensure that a page's elemental area content is indexed under the page's data.

For information on configuring Solr please see the fulltextsearch documentation.

Note: If using this indexer, be aware that HTML tags will be stripped from the content before it is indexed. The Solr search results may add in emphasis tags or other formatting around matched key words, so you may need to allow unescaped HTML in your search results template. You should use the $Excerpt property (see SolrIndex::search for more) to display the relevant search matches.

Disabling CMS content search

When installing this module, the page model admin search will look for a term in the entire content of each elemental pages. This is done by rendering each page, which can be resource hungry and make the search timeout.

You can disable this with YAML configuration:

Usage of GridField

This module used to use GridField to create and update Elements in the CMS. This has now been largely succeeded by a JavaScript interface via React. However elements that are marked as being incompatible with in-line editing will still use the GridField method.

Building the elemental frontend assets

This module uses the Silverstripe CMS Webpack module, and inherits things from the core Silverstripe CMS 4 modules, such as a core variable sheet and Javascript components.

When making changes to either the SASS or Javascript files, ensure you change the source files in client/src/.

You can have yarn watch and rebuild delta changes as you make them (for development only):

When you're ready to make a pull request you can rebuild them, which will also minify everything. Note that watch will generate source map files which you shouldn't commit in for your final pull request. To minify and package:

You'll need to have yarn installed globally in your command line.

Note: If adding or modifying colours, spacing, font sizes etc. please try and use an appropriate variable from the silverstripe/admin module if available.

Integration with other modules

Upgrading

For developers upgrading from Elemental 3 to 4, see the upgrade guide.

Screenshots

Versioning

This library follows Semver. According to Semver, you will be able to upgrade to any minor or patch version of this library without any breaking changes to the public API. Semver also requires that we clearly define the public API for this library.

All methods, with public visibility, are part of the public API. All other methods are not part of the public API. Where possible, we'll try to keep protected methods backwards-compatible in minor/patch versions, but if you're overriding methods then please test your work before upgrading.

Reporting Issues

Please create an issue for any bugs you've found, or features you're missing.

Credits

Silverstripe Elemental was created by DNA Design.

CMS Icon blocks by Creative Stall from the Noun Project.


All versions of silverstripe-elemental-grid with dependencies

PHP Build Version
Package Version
Requires silverstripe/cms Version ^4.0@dev
silverstripe/vendor-plugin Version ^1.0
dnadesign/silverstripe-elemental Version ^3.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 dennisprins/silverstripe-elemental-grid contains the following files

Loading the files please wait ....