Download the PHP package / without Composer

On this page you can find all versions of the php package /. 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?
/
Rate from 1 - 5
Rated 5.00 based on 2 reviews

Informations about the package

Widgets Module

CI Silverstripe supported module

Overview

Widgets are small pieces of functionality such as showing the latest comments or Flickr photos. They normally display on the sidebar of your website.

Installation

Setup

Widgets are essentially database relations to other models, mostly page types. By default, they're not added to any of your own models. The easiest and most common way to get started would be to create a single collection of widgets under the name "SideBar" on your Page class. This is handled by an extension which you can enable through your config.yml:

Run a dev/build, and adjust your templates to include the resulting sidebar view. The placeholder is called $SideBarView, and loops through all widgets assigned to the current page.

Alternatively, you can add one or more widget collections to your own page types. Here's an example on how to just add widgets to a MyPage type, and call it MyWidgetArea instead. Please ensure you add the correct namespaces for your module.

Installing a widget

By following the "Packaging" rules below, widgets are easily installed. This example uses the Blog module which by default has widgets already enabled.

Documentation

See the docs/en folder.

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.

Reporting Issues

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

mysite/code/Page.php

In this case, you need to alter your templates to include the $MyWidgetArea placeholder.

Writing your own widgets

To create a Widget you need at least three files - a php file containing the class, a template file of the same name and a config file called _config.php (if you dont need any config options for the widget to work then you can make it blank). Each widget should be in its own folder like widgets_widgetName/

After installing or creating a new widget, make sure to run db/build?flush=1 at the end of the URL, before attempting to use it.

The class should extend the Widget class, and must specify three config variables:

If a Widget has configurable options, then it can specify a number of database fields to store these options in via the static $db array, and also specify a getCMSFields function that returns a FieldList, much the same way as a page type does.

An example widget is below:

FlickrWidget.php

FlickrWidget.ss

Releasing a widget

Follow the standard procedures defined for releasing a Silverstripe module.

Here is a composer template you can use.

You need to finish off / change:

Extending and Customizing

Rendering a $Widget Individually

To call a single Widget in a page - without adding a widget area in the CMS for you to add / delete the widgets, you can define a merge variable in the Page Controller and include it in the Page Template.

This example creates an RSSWidget with the Silverstripe blog feed.

To render the widget, simply include $SilverStripeFeed in your template:

As directed in the definition of SilverStripeFeed(), the Widget will be rendered through the WidgetHolder template. This is pre-defined at widgets/templates/WidgetHolder.ss and simply consists of:

You can override the WidgetHolder.ss and Widget.ss templates in your theme too by adding WidgetHolder and Widget templates to themes/myThemeName/templates/Includes/

Changing the title of your widget

To change the title of your widget, you need to override the getTitle() method. By default, this simply returns the $title variable. For example, to set your widgets title to 'Hello World!', you could use:

widgets_yourWidget/src/YourWidgetWidget.php

but, you can do exactly the same by setting your $title variable.

A more common reason for overriding getTitle() is to allow the title to be set in the CMS. Say you had a text field in your widget called WidgetTitle, that you wish to use as your title. If nothing is set, then you'll use your default title. This is similar to the RSS Widget in the blog module.

This returns the value inputted in the CMS, if it's set or what is in the $title variable if it isn't.

Forms within Widgets

To implement a form inside a widget, you need to implement a custom controller for your widget to return this form. Make sure that your controller follows the usual naming conventions, and it will be automatically picked up by the WidgetArea rendering in your Page.ss template.

mysite/code/MyWidget.php

To output this form, modify your widget template.

mysite/templates/Yourname/MyWidget/MyWidget.ss

Note: The necessary controller actions are only present in subclasses of PageController. To use widget forms in other controller subclasses, have a look at ContentController->handleWidget() and ContentController::$url_handlers.

But what if I have widgets on my blog currently??

Note: This applies to old versions of the blog module. The latest version of this module does not contain BlogHolder.php.

If you currently have a blog installed, the widget fields are going to double up on those pages (as the blog extends the Page class). One way to fix this is to comment out line 30 in BlogHolder.php and remove the DB entry by running a http://www.mysite.com/db/build.

blog/code/BlogHolder.php

Then you can use the Widget area you defined on Page.php

Translations

Translations of the natural language strings are managed through a third party translation interface, transifex.com. Newly added strings will be periodically uploaded there for translation, and any new translations will be merged back to the project source code.

Please use https://www.transifex.com/projects/p/silverstripe-widgets/ to contribute translations, rather than sending pull requests with YAML files.

See the "i18n" topic on docs.silverstripe.org for more details.


All versions of with dependencies

PHP Build Version
Package Version
Requires silverstripe/vendor-plugin Version ^1.0
silverstripe/framework Version ^4.10
silverstripe/cms Version ^4.0
silverstripe/versioned Version ^1.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 / contains the following files

Loading the files please wait ....