Compare commits
48 Commits
Author | SHA1 | Date |
---|---|---|
Guy Sartorelli | eacb02c297 | |
Guy Sartorelli | afe1cc5da0 | |
Guy Sartorelli | f2b92e8f83 | |
Guy Sartorelli | 2b53f5095c | |
Maxime Rainville | d27f656e97 | |
Steve Boyd | b615184c54 | |
Guy Sartorelli | a9a20ab1c0 | |
Guy Sartorelli | 8ad0537473 | |
Guy Sartorelli | 02d5a17e1f | |
Guy Sartorelli | 53e7646700 | |
Steve Boyd | 812f3dc282 | |
Steve Boyd | 9934adecdb | |
Steve Boyd | 08cdad1290 | |
Guy Sartorelli | 08554e7882 | |
Steve Boyd | 57b1d87577 | |
Steve Boyd | 3fd8120b74 | |
Steve Boyd | d907c77ed6 | |
Guy Sartorelli | 65ef1bbc50 | |
Steve Boyd | d16e4770da | |
Steve Boyd | 3685869917 | |
Steve Boyd | 3d89a29628 | |
Guy Sartorelli | d78326987c | |
Steve Boyd | 51d29b3d5a | |
Maxime Rainville | 5aca443a7c | |
Steve Boyd | 2b9536e5ae | |
Steve Boyd | a08aa08f4d | |
Maxime Rainville | 6c2b654f19 | |
Maxime Rainville | 6e163beb44 | |
Steve Boyd | d4ae7ff9ab | |
Steve Boyd | 92f90fbea5 | |
Maxime Rainville | f759a8b56b | |
Maxime Rainville | 81b59ab4b9 | |
Steve Boyd | 0f37c09531 | |
Steve Boyd | c3fc2cab68 | |
Serge Latyntsev | 0fda5eec16 | |
Steve Boyd | 1265ce99a6 | |
Garion Herman | 8db05ea5f0 | |
Serge Latyntsev | 007b6fcdfa | |
Garion Herman | 42af10671e | |
Garion Herman | f396ee7242 | |
Robbie Averill | ade8047461 | |
wernerkrauss | 5d2f0570d8 | |
Robbie Averill | 7d2dd46159 | |
Dylan Wagstaff | 41c9ecffe6 | |
Robbie Averill | 35df96f502 | |
Robbie Averill | 6ce962607f | |
Robbie Averill | eb81b3c8d9 | |
Raissa North | 129a650729 |
|
@ -0,0 +1,11 @@
|
|||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
pull_request:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
ci:
|
||||
name: CI
|
||||
uses: silverstripe/gha-ci/.github/workflows/ci.yml@v1
|
|
@ -0,0 +1,16 @@
|
|||
name: Dispatch CI
|
||||
|
||||
on:
|
||||
# At 1:00 PM UTC, only on Saturday and Sunday
|
||||
schedule:
|
||||
- cron: '0 13 * * 6,0'
|
||||
|
||||
jobs:
|
||||
dispatch-ci:
|
||||
name: Dispatch CI
|
||||
# Only run cron on the silverstripe account
|
||||
if: (github.event_name == 'schedule' && github.repository_owner == 'silverstripe') || (github.event_name != 'schedule')
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Dispatch CI
|
||||
uses: silverstripe/gha-dispatch-ci@v1
|
|
@ -0,0 +1,17 @@
|
|||
name: Keepalive
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
# The 4th of every month at 10:50am UTC
|
||||
schedule:
|
||||
- cron: '50 10 4 * *'
|
||||
|
||||
jobs:
|
||||
keepalive:
|
||||
name: Keepalive
|
||||
# Only run cron on the silverstripe account
|
||||
if: (github.event_name == 'schedule' && github.repository_owner == 'silverstripe') || (github.event_name != 'schedule')
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Keepalive
|
||||
uses: silverstripe/gha-keepalive@v1
|
|
@ -1,15 +0,0 @@
|
|||
inherit: true
|
||||
|
||||
build:
|
||||
nodes:
|
||||
analysis:
|
||||
tests:
|
||||
override: [php-scrutinizer-run]
|
||||
|
||||
checks:
|
||||
php:
|
||||
code_rating: true
|
||||
duplication: true
|
||||
|
||||
filter:
|
||||
paths: [src/*, tests/*]
|
31
.travis.yml
31
.travis.yml
|
@ -1,31 +0,0 @@
|
|||
language: php
|
||||
|
||||
env:
|
||||
global:
|
||||
- COMPOSER_ROOT_VERSION="2.x-dev"
|
||||
|
||||
matrix:
|
||||
include:
|
||||
- php: 5.6
|
||||
env: DB=MYSQL PHPCS_TEST=1 PHPUNIT_TEST=1
|
||||
- php: 7.0
|
||||
env: DB=PGSQL PHPUNIT_TEST=1
|
||||
- php: 7.1
|
||||
env: DB=MYSQL PHPUNIT_COVERAGE_TEST=1
|
||||
|
||||
before_script:
|
||||
- phpenv rehash
|
||||
- phpenv config-rm xdebug.ini
|
||||
|
||||
- composer install --prefer-dist
|
||||
- composer require --prefer-dist --no-update silverstripe/recipe-cms:1.0.x-dev
|
||||
- if [[ $DB == PGSQL ]]; then composer require --prefer-dist --no-update silverstripe/postgresql:2.0.x-dev; fi
|
||||
- composer update
|
||||
|
||||
script:
|
||||
- if [[ $PHPUNIT_TEST ]]; then vendor/bin/phpunit; fi
|
||||
- if [[ $PHPUNIT_COVERAGE_TEST ]]; then phpdbg -qrr vendor/bin/phpunit --coverage-clover=coverage.xml; fi
|
||||
- if [[ $PHPCS_TEST ]]; then vendor/bin/phpcs --standard=vendor/silverstripe/framework/phpcs.xml.dist src/ tests/ ; fi
|
||||
|
||||
after_success:
|
||||
- if [[ $PHPUNIT_COVERAGE_TEST ]]; then bash <(curl -s https://codecov.io/bash) -f coverage.xml; fi
|
|
@ -1,8 +1,9 @@
|
|||
[main]
|
||||
host = https://www.transifex.com
|
||||
|
||||
[silverstripe-widgets.master]
|
||||
[o:silverstripe:p:silverstripe-widgets:r:master]
|
||||
file_filter = lang/<lang>.yml
|
||||
source_file = lang/en.yml
|
||||
source_lang = en
|
||||
type = YML
|
||||
type = YML
|
||||
|
||||
|
|
49
README.md
49
README.md
|
@ -1,8 +1,7 @@
|
|||
# Widgets Module
|
||||
|
||||
[![Build Status](http://img.shields.io/travis/silverstripe/silverstripe-widgets.svg)](https://travis-ci.org/silverstripe/silverstripe-widgets)
|
||||
[![Code Quality](http://img.shields.io/scrutinizer/g/silverstripe/silverstripe-widgets.svg)](https://scrutinizer-ci.com/g/silverstripe/silverstripe-widgets)
|
||||
[![Code Coverage](https://img.shields.io/codecov/c/github/silverstripe/silverstripe-widgets.svg)](https://codecov.io/gh/silverstripe/silverstripe-widgets)
|
||||
[![CI](https://github.com/silverstripe/silverstripe-widgets/actions/workflows/ci.yml/badge.svg)](https://github.com/silverstripe/silverstripe-widgets/actions/workflows/ci.yml)
|
||||
[![Silverstripe supported module](https://img.shields.io/badge/silverstripe-supported-0071C4.svg)](https://www.silverstripe.org/software/addons/silverstripe-commercially-supported-module-list/)
|
||||
|
||||
## Overview
|
||||
|
||||
|
@ -11,9 +10,9 @@ the sidebar of your website.
|
|||
|
||||
## Requirements
|
||||
|
||||
* SilverStripe 4.0
|
||||
* Silverstripe 4.0
|
||||
|
||||
**Note:** this version is compatible with SilverStripe 4. For SilverStripe 3, please see [the 1.x release line](https://github.com/silverstripe/silverstripe-widgets/tree/1.3).
|
||||
**Note:** this version is compatible with Silverstripe 4. For Silverstripe 3, please see [the 1.x release line](https://github.com/silverstripe/silverstripe-widgets/tree/1.3).
|
||||
|
||||
### Installation
|
||||
|
||||
|
@ -29,6 +28,31 @@ 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`:
|
||||
|
||||
```yaml
|
||||
Page:
|
||||
extensions:
|
||||
- SilverStripe\Widgets\Extensions\WidgetPageExtension
|
||||
```
|
||||
|
||||
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.
|
||||
|
||||
* Install the [blog module](https://github.com/silverstripe/silverstripe-blog/).
|
||||
* Download the widget and unzip to the main folder of your Silverstripe website, e.g. to `/widget_<widget-name>/`. The folder
|
||||
will contain a few files, which generally won't need editing or reading.
|
||||
* Run `http://my-website.com/dev/build`
|
||||
* Login to the CMS and go to the 'Blog' page. Choose the "widgets" tab and click the new widget to activate it.
|
||||
* Your blog will now have the widget shown
|
||||
|
||||
## Documentation
|
||||
|
||||
See the [docs/en](docs/en/introduction.md) folder.
|
||||
|
@ -37,20 +61,10 @@ See the [docs/en](docs/en/introduction.md) folder.
|
|||
|
||||
This library follows [Semver](http://semver.org). 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.
|
||||
|
||||
By following the "Packaging" rules below, widgets are easily installed. This example uses the Blog module which by default has widgets already enabled.
|
||||
|
||||
* Install the [blog module](https://github.com/silverstripe/silverstripe-blog/).
|
||||
* Download the widget and unzip to the main folder of your SilverStripe website, e.g. to `/widget_<widget-name>/`. The folder
|
||||
will contain a few files, which generally won't need editing or reading.
|
||||
* Run `http://my-website.com/dev/build`
|
||||
* Login to the CMS and go to the 'Blog' page. Choose the "widgets" tab and click the new widget to activate it.
|
||||
* Your blog will now have the widget shown
|
||||
|
||||
## Reporting Issues
|
||||
|
||||
Please [create an issue](http://github.com/silverstripe/silverstripe-widgets/issues) for any bugs you've found, or features you're missing.
|
||||
|
||||
|
||||
* Install the Widgets Module, see above.
|
||||
* Add a WidgetArea field to your Page.
|
||||
* Add a new tab to the CMS with a WidgetAreaEditor field for managing the widgets.
|
||||
|
@ -188,10 +202,9 @@ class FlickrWidget extends Widget
|
|||
<% end_control %>
|
||||
```
|
||||
|
||||
|
||||
## Releasing a widget
|
||||
|
||||
Follow the [standard procedures defined for releasing a SilverStripe module](https://docs.silverstripe.org/en/4/developer_guides/extending/how_tos/publish_a_module).
|
||||
Follow the [standard procedures defined for releasing a Silverstripe module](https://docs.silverstripe.org/en/4/developer_guides/extending/how_tos/publish_a_module).
|
||||
|
||||
Here is a composer template you can use.
|
||||
|
||||
|
@ -239,7 +252,7 @@ You need to finish off / change:
|
|||
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.
|
||||
This example creates an RSSWidget with the Silverstripe blog feed.
|
||||
|
||||
```php
|
||||
public function SilverStripeFeed()
|
||||
|
|
|
@ -2,7 +2,11 @@
|
|||
"name": "silverstripe/widgets",
|
||||
"description": "Widgets are small pieces of functionality such as showing the latest Comments or Flickr Photos. They normally display on the sidebar of your website.",
|
||||
"type": "silverstripe-vendormodule",
|
||||
"keywords": ["silverstripe", "widgets", "blog"],
|
||||
"keywords": [
|
||||
"silverstripe",
|
||||
"widgets",
|
||||
"blog"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Ingo Schommer",
|
||||
|
@ -11,18 +15,15 @@
|
|||
],
|
||||
"require": {
|
||||
"silverstripe/vendor-plugin": "^1.0",
|
||||
"silverstripe/framework": "^4.0",
|
||||
"silverstripe/framework": "^4.10",
|
||||
"silverstripe/cms": "^4.0",
|
||||
"silverstripe/versioned": "^1.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^5.7",
|
||||
"phpunit/phpunit": "^9.5",
|
||||
"squizlabs/php_codesniffer": "^3.0"
|
||||
},
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "2.x-dev"
|
||||
},
|
||||
"expose": [
|
||||
"css",
|
||||
"javascript"
|
||||
|
@ -37,4 +38,4 @@
|
|||
"license": "BSD-3-Clause",
|
||||
"minimum-stability": "dev",
|
||||
"prefer-stable": true
|
||||
}
|
||||
}
|
12
lang/ar.yml
12
lang/ar.yml
|
@ -1,16 +1,16 @@
|
|||
ar:
|
||||
SilverStripe\Widgets\Model\Widget:
|
||||
PLURALNAME: 'تطبيقات مصغرة'
|
||||
SINGULARNAME: 'تطبيق مصغر'
|
||||
SilverStripe\Widgets\Model\WidgetArea:
|
||||
PLURALNAME: 'مساحات التطبيقات المصغرة'
|
||||
SINGULARNAME: 'مساحة التطبيقات المصغرة'
|
||||
SilverStripe\Widgets\Forms\WidgetAreaEditor_ss:
|
||||
AVAILABLE: 'التطبيقات المصغرة المتاحة'
|
||||
AVAILWIDGETS: 'اضغط على عنوان تطبيق مصغر بالأسفل لاستخدامه بهذه الصفحة.'
|
||||
INUSE: 'التطبيقات المصغرة المستخدمة حاليا'
|
||||
NOAVAIL: 'لا توجد حاليا أية تطبيقات مصغرة متاحة.'
|
||||
TOSORT: 'لترتيب التطبيقات المصغرة المستخدمة حاليا فى هذه الصفحة, اسحبها لأعلى و لأسفل.'
|
||||
SilverStripe\Widgets\Model\Widget:
|
||||
PLURALNAME: 'تطبيقات مصغرة'
|
||||
SINGULARNAME: 'تطبيق مصغر'
|
||||
SilverStripe\Widgets\Model\WidgetArea:
|
||||
PLURALNAME: 'مساحات التطبيقات المصغرة'
|
||||
SINGULARNAME: 'مساحة التطبيقات المصغرة'
|
||||
WidgetDescription_ss:
|
||||
CLICKTOADDWIDGET: 'اضغط لإضافة هذا التطبيق المصغر'
|
||||
WidgetEditor_ss:
|
||||
|
|
12
lang/de.yml
12
lang/de.yml
|
@ -1,16 +1,16 @@
|
|||
de:
|
||||
SilverStripe\Widgets\Model\Widget:
|
||||
PLURALNAME: Widgets
|
||||
SINGULARNAME: Widget
|
||||
SilverStripe\Widgets\Model\WidgetArea:
|
||||
PLURALNAME: Widgetbereiche
|
||||
SINGULARNAME: Widgetbereich
|
||||
SilverStripe\Widgets\Forms\WidgetAreaEditor_ss:
|
||||
AVAILABLE: 'Vorhandene Widgets'
|
||||
AVAILWIDGETS: 'Klicke den Widget Titel, um es zu benutzen.'
|
||||
INUSE: 'Benutzte Widgets'
|
||||
NOAVAIL: 'Es sind derzeit keine Widgets verfügbar.'
|
||||
TOSORT: 'Um die Widgets auf dieser Seite zu sortieren, ziehe sie nach oben oder unten.'
|
||||
SilverStripe\Widgets\Model\Widget:
|
||||
PLURALNAME: Widgets
|
||||
SINGULARNAME: Widget
|
||||
SilverStripe\Widgets\Model\WidgetArea:
|
||||
PLURALNAME: Widgetbereiche
|
||||
SINGULARNAME: Widgetbereich
|
||||
WidgetDescription_ss:
|
||||
CLICKTOADDWIDGET: 'Klicke um dieses Widget hinzuzufügen'
|
||||
WidgetEditor_ss:
|
||||
|
|
20
lang/eo.yml
20
lang/eo.yml
|
@ -1,16 +1,24 @@
|
|||
eo:
|
||||
SilverStripe\Widgets\Model\Widget:
|
||||
PLURALNAME: Fenestraĵoj
|
||||
SINGULARNAME: Fenestraĵo
|
||||
SilverStripe\Widgets\Model\WidgetArea:
|
||||
PLURALNAME: 'Fenestraĵaj zonoj'
|
||||
SINGULARNAME: 'Fenestraĵa zono'
|
||||
SilverStripe\Widgets\Extensions\WidgetPageExtension:
|
||||
INHERITSIDEBAR: 'Heredi flankpanelon el patro'
|
||||
SilverStripe\Widgets\Forms\WidgetAreaEditor_ss:
|
||||
AVAILABLE: 'Disponeblaj fenestraĵoj'
|
||||
AVAILWIDGETS: 'Alklaku sube titolon de fenestraĵo por uzi ĝin en ĉi tiu paĝo.'
|
||||
INUSE: 'Fenestraĵoj aktuale uzataj'
|
||||
NOAVAIL: 'Aktuale mankas disponeblaj fenestraĵoj.'
|
||||
TOSORT: 'Por ordigi aktuale uzatajn fenestraĵojn en ĉi tiu paĝo, ŝovu ilin supren kaj malsupren.'
|
||||
SilverStripe\Widgets\Model\Widget:
|
||||
PLURALNAME: Fenestraĵoj
|
||||
PLURALS:
|
||||
one: 'Unu fenestraĵo'
|
||||
other: '{count} fenestraĵoj'
|
||||
SINGULARNAME: Fenestraĵo
|
||||
SilverStripe\Widgets\Model\WidgetArea:
|
||||
PLURALNAME: 'Fenestraĵaj zonoj'
|
||||
PLURALS:
|
||||
one: 'Unu fenestraĵa zono'
|
||||
other: '{count} fenestraĵaj zonoj'
|
||||
SINGULARNAME: 'Fenestraĵa zono'
|
||||
WidgetDescription_ss:
|
||||
CLICKTOADDWIDGET: 'Alklaku por aldoni la fenestraĵon'
|
||||
WidgetEditor_ss:
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
fa_IR:
|
||||
SilverStripe\Widgets\Model\Widget:
|
||||
PLURALNAME: 'ویجت ها'
|
||||
SINGULARNAME: ویجت
|
||||
SilverStripe\Widgets\Model\WidgetArea:
|
||||
PLURALNAME: 'محیط ویجت ها'
|
||||
SINGULARNAME: 'محیط ویجت'
|
||||
SilverStripe\Widgets\Forms\WidgetAreaEditor_ss:
|
||||
AVAILABLE: 'ویجت های موجود'
|
||||
AVAILWIDGETS: 'بر روی عنوان یک ویجت در پایین کلیک کنید تا آن را در این صفحه بکار بگیرید.'
|
||||
INUSE: 'ویجت هایی که در حال حاضر استفاده می شوند'
|
||||
NOAVAIL: 'در حال حاضر هیچ ویجتی موجود نیست.'
|
||||
TOSORT: 'برای مرتب سازی ویجت های این صفحه، آنها را بالا و پایین بکشید.'
|
||||
SilverStripe\Widgets\Model\Widget:
|
||||
PLURALNAME: 'ویجت ها'
|
||||
SINGULARNAME: ویجت
|
||||
SilverStripe\Widgets\Model\WidgetArea:
|
||||
PLURALNAME: 'محیط ویجت ها'
|
||||
SINGULARNAME: 'محیط ویجت'
|
||||
WidgetDescription_ss:
|
||||
CLICKTOADDWIDGET: 'برای افزودن این ویجت کلیک کنید'
|
||||
WidgetEditor_ss:
|
||||
|
|
12
lang/fi.yml
12
lang/fi.yml
|
@ -1,16 +1,16 @@
|
|||
fi:
|
||||
SilverStripe\Widgets\Model\Widget:
|
||||
PLURALNAME: Vimpaimet
|
||||
SINGULARNAME: Vimpain
|
||||
SilverStripe\Widgets\Model\WidgetArea:
|
||||
PLURALNAME: 'Vimpain alueet'
|
||||
SINGULARNAME: 'Vimpain alue'
|
||||
SilverStripe\Widgets\Forms\WidgetAreaEditor_ss:
|
||||
AVAILABLE: 'Käytettävissä olevat vimpaimet'
|
||||
AVAILWIDGETS: 'Napsauta vimpaimen otsikkoa alla ottaaksesi se käyttöön tällä sivulla.'
|
||||
INUSE: 'Käytössä olevat vimpaimet'
|
||||
NOAVAIL: 'Tällä hetkellä ei vimpaimia tarjolla.'
|
||||
TOSORT: 'Järjestääksesi käytössä olevat vimpaimet, raahaa ja pudota ne paikoilleen.'
|
||||
SilverStripe\Widgets\Model\Widget:
|
||||
PLURALNAME: Vimpaimet
|
||||
SINGULARNAME: Vimpain
|
||||
SilverStripe\Widgets\Model\WidgetArea:
|
||||
PLURALNAME: 'Vimpain alueet'
|
||||
SINGULARNAME: 'Vimpain alue'
|
||||
WidgetDescription_ss:
|
||||
CLICKTOADDWIDGET: 'Napsauta lisätäksesi tämä vimpain'
|
||||
WidgetEditor_ss:
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
fi_FI:
|
||||
SilverStripe\Widgets\Forms\WidgetAreaEditor_ss:
|
||||
AVAILABLE: 'Käytettävissä olevat vimpaimet'
|
||||
AVAILWIDGETS: 'Napsauta vimpaimen otsikkoa alla ottaaksesi se käyttöön tällä sivulla.'
|
||||
INUSE: 'Käytössä olevat vimpaimet'
|
||||
NOAVAIL: 'Tällä hetkellä ei vimpaimia tarjolla.'
|
||||
TOSORT: 'Järjestääksesi käytössä olevat vimpaimet, raahaa ja pudota ne paikoilleen.'
|
||||
SilverStripe\Widgets\Model\Widget:
|
||||
PLURALNAME: Vimpaimet
|
||||
SINGULARNAME: Vimpain
|
||||
SilverStripe\Widgets\Model\WidgetArea:
|
||||
PLURALNAME: 'Vimpain alueet'
|
||||
SINGULARNAME: 'Vimpain alue'
|
||||
WidgetDescription_ss:
|
||||
CLICKTOADDWIDGET: 'Napsauta lisätäksesi tämä vimpain'
|
||||
WidgetEditor_ss:
|
||||
DELETE: Poista
|
12
lang/hr.yml
12
lang/hr.yml
|
@ -1,16 +1,16 @@
|
|||
hr:
|
||||
SilverStripe\Widgets\Model\Widget:
|
||||
PLURALNAME: Widgeti
|
||||
SINGULARNAME: Widget
|
||||
SilverStripe\Widgets\Model\WidgetArea:
|
||||
PLURALNAME: 'Zone widgeta'
|
||||
SINGULARNAME: 'Zona widgeta'
|
||||
SilverStripe\Widgets\Forms\WidgetAreaEditor_ss:
|
||||
AVAILABLE: 'Dostupni widgeti'
|
||||
AVAILWIDGETS: 'Kliknite na naziv widgeta ispod za korištenje na ovoj stranici'
|
||||
INUSE: 'Trenutno korišteni widgeti'
|
||||
NOAVAIL: 'Trenutno nema dostupnih widgeta.'
|
||||
TOSORT: 'Za sortiranje trenutno korištenih widgeta na ovoj stranici, rasporedite ih povlačeći gore i dolje.'
|
||||
SilverStripe\Widgets\Model\Widget:
|
||||
PLURALNAME: Widgeti
|
||||
SINGULARNAME: Widget
|
||||
SilverStripe\Widgets\Model\WidgetArea:
|
||||
PLURALNAME: 'Zone widgeta'
|
||||
SINGULARNAME: 'Zona widgeta'
|
||||
WidgetDescription_ss:
|
||||
CLICKTOADDWIDGET: 'Klikni za dodavanje ovog widgeta'
|
||||
WidgetEditor_ss:
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
id_ID:
|
||||
SilverStripe\Widgets\Forms\WidgetAreaEditor_ss:
|
||||
AVAILABLE: 'Widget Tersedia'
|
||||
WidgetEditor_ss:
|
||||
DELETE: Hapus
|
|
@ -0,0 +1,17 @@
|
|||
it:
|
||||
SilverStripe\Widgets\Forms\WidgetAreaEditor_ss:
|
||||
AVAILABLE: 'Widget Disponibili'
|
||||
AVAILWIDGETS: 'Clickare sul titolo di un widget per usarlo in questa pagina'
|
||||
INUSE: 'Widget attualmente in uso'
|
||||
NOAVAIL: 'Attualmente non ci sono widget disponibili'
|
||||
TOSORT: 'Per riordinare i widget usati in questa pagina, trascinarli in alto o in basso.'
|
||||
SilverStripe\Widgets\Model\Widget:
|
||||
PLURALNAME: Widget
|
||||
SINGULARNAME: Widget
|
||||
SilverStripe\Widgets\Model\WidgetArea:
|
||||
PLURALNAME: 'Aree Widget'
|
||||
SINGULARNAME: 'Area Widget'
|
||||
WidgetDescription_ss:
|
||||
CLICKTOADDWIDGET: 'Clickare per aggiungere questo widget'
|
||||
WidgetEditor_ss:
|
||||
DELETE: Elimina
|
|
@ -1,16 +1,16 @@
|
|||
it_IT:
|
||||
SilverStripe\Widgets\Model\Widget:
|
||||
PLURALNAME: Widgets
|
||||
SINGULARNAME: Widget
|
||||
SilverStripe\Widgets\Model\WidgetArea:
|
||||
PLURALNAME: 'Aree Widget'
|
||||
SINGULARNAME: 'Area Widget'
|
||||
SilverStripe\Widgets\Forms\WidgetAreaEditor_ss:
|
||||
AVAILABLE: 'Widgets disponibili'
|
||||
AVAILWIDGETS: 'Clicca sul titolo di un widget qui sotto per usarlo in questa pagina'
|
||||
INUSE: 'Widgets attualmente utilizzati'
|
||||
NOAVAIL: 'Non ci sono widgets attualmente disponibili.'
|
||||
TOSORT: 'Per ordinare i widgets utilizzati in questa pagina, trascinali in alto o in basso.'
|
||||
SilverStripe\Widgets\Model\Widget:
|
||||
PLURALNAME: Widgets
|
||||
SINGULARNAME: Widget
|
||||
SilverStripe\Widgets\Model\WidgetArea:
|
||||
PLURALNAME: 'Aree Widget'
|
||||
SINGULARNAME: 'Area Widget'
|
||||
WidgetDescription_ss:
|
||||
CLICKTOADDWIDGET: 'Clicca per aggiungere questo widget'
|
||||
WidgetEditor_ss:
|
||||
|
|
|
@ -5,6 +5,12 @@ nl:
|
|||
INUSE: 'Huidige gebruikte Widgets'
|
||||
NOAVAIL: 'Er zijn geen widgets beschikbaar.'
|
||||
TOSORT: 'Om uw widgets te sorteren op deze pagina, rangschik met drag & drop.'
|
||||
SilverStripe\Widgets\Model\Widget:
|
||||
PLURALNAME: Widgets
|
||||
SINGULARNAME: Widget
|
||||
SilverStripe\Widgets\Model\WidgetArea:
|
||||
PLURALNAME: 'Widget plaatsen'
|
||||
SINGULARNAME: 'Widget plaats'
|
||||
WidgetDescription_ss:
|
||||
CLICKTOADDWIDGET: 'Klik om deze widget toe te voegen'
|
||||
WidgetEditor_ss:
|
||||
|
|
12
lang/ru.yml
12
lang/ru.yml
|
@ -1,16 +1,16 @@
|
|||
ru:
|
||||
SilverStripe\Widgets\Model\Widget:
|
||||
PLURALNAME: Виджеты
|
||||
SINGULARNAME: Виджет
|
||||
SilverStripe\Widgets\Model\WidgetArea:
|
||||
PLURALNAME: 'Области виджетов'
|
||||
SINGULARNAME: 'Область виджета'
|
||||
SilverStripe\Widgets\Forms\WidgetAreaEditor_ss:
|
||||
AVAILABLE: 'Доступные виджеты'
|
||||
AVAILWIDGETS: 'Щелкните заголовок виджета ниже, чтобы использовать его на этой странице.'
|
||||
INUSE: 'Используемые виджеты'
|
||||
NOAVAIL: 'В данный момент доступных виджетов нет.'
|
||||
TOSORT: 'Чтобы расположить используемые на странице виджеты в нужном порядке, перетащите их вверх или вниз.'
|
||||
SilverStripe\Widgets\Model\Widget:
|
||||
PLURALNAME: Виджеты
|
||||
SINGULARNAME: Виджет
|
||||
SilverStripe\Widgets\Model\WidgetArea:
|
||||
PLURALNAME: 'Области виджетов'
|
||||
SINGULARNAME: 'Область виджета'
|
||||
WidgetDescription_ss:
|
||||
CLICKTOADDWIDGET: 'Щелкните, чтобы добавить этот виджет'
|
||||
WidgetEditor_ss:
|
||||
|
|
12
lang/sk.yml
12
lang/sk.yml
|
@ -1,16 +1,16 @@
|
|||
sk:
|
||||
SilverStripe\Widgets\Model\Widget:
|
||||
PLURALNAME: Widgety
|
||||
SINGULARNAME: Widget
|
||||
SilverStripe\Widgets\Model\WidgetArea:
|
||||
PLURALNAME: 'Oblasti widgetu'
|
||||
SINGULARNAME: 'Oblasť widgetu'
|
||||
SilverStripe\Widgets\Forms\WidgetAreaEditor_ss:
|
||||
AVAILABLE: 'Dostupné widgety'
|
||||
AVAILWIDGETS: 'Kliknite na názov widgetu pre jeho použitie na tejto stránke.'
|
||||
INUSE: 'Momentálne používané widgety.'
|
||||
NOAVAIL: 'Momentálne nie sú dostupné žiadne widgety.'
|
||||
TOSORT: 'Pre zotriedenie momentálne používaných widgetov na tejto stránke, potiahnite ich hore alebo dole.'
|
||||
SilverStripe\Widgets\Model\Widget:
|
||||
PLURALNAME: Widgety
|
||||
SINGULARNAME: Widget
|
||||
SilverStripe\Widgets\Model\WidgetArea:
|
||||
PLURALNAME: 'Oblasti widgetu'
|
||||
SINGULARNAME: 'Oblasť widgetu'
|
||||
WidgetDescription_ss:
|
||||
CLICKTOADDWIDGET: 'Kliknite pre pridanie tohto widgetu'
|
||||
WidgetEditor_ss:
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
sl:
|
||||
SilverStripe\Widgets\Forms\WidgetAreaEditor_ss:
|
||||
AVAILABLE: 'Vtičniki, ki so na voljo'
|
||||
AVAILWIDGETS: 'Spodaj izberite vtičnik, ki ga želite uporabiti na strani.'
|
||||
INUSE: 'Vtičniki v uporabi'
|
||||
NOAVAIL: 'Na voljo ni nobenega vtičnika.'
|
||||
TOSORT: 'Za razvrstitev vtičnikov na strani jih povlecite na ustrezno mesto. '
|
||||
SilverStripe\Widgets\Model\Widget:
|
||||
PLURALNAME: Vtičniki
|
||||
SINGULARNAME: Vtičnik
|
||||
SilverStripe\Widgets\Model\WidgetArea:
|
||||
PLURALNAME: 'Prostori za vtičnike'
|
||||
SINGULARNAME: 'Prostor za vtičnike'
|
||||
WidgetDescription_ss:
|
||||
CLICKTOADDWIDGET: 'Kliknite na ta vtičnik, če ga želite dodati'
|
||||
WidgetEditor_ss:
|
||||
DELETE: Odstrani
|
12
lang/sv.yml
12
lang/sv.yml
|
@ -1,16 +1,16 @@
|
|||
sv:
|
||||
SilverStripe\Widgets\Model\Widget:
|
||||
PLURALNAME: Widgets
|
||||
SINGULARNAME: Widget
|
||||
SilverStripe\Widgets\Model\WidgetArea:
|
||||
PLURALNAME: Widgetområden
|
||||
SINGULARNAME: Widgetområde
|
||||
SilverStripe\Widgets\Forms\WidgetAreaEditor_ss:
|
||||
AVAILABLE: 'Tillgängliga widgets'
|
||||
AVAILWIDGETS: 'Klicka på en widget nedan för att använda den på sidan.'
|
||||
INUSE: 'Använda widgets'
|
||||
NOAVAIL: 'Inga widgets tillängliga.'
|
||||
TOSORT: 'För att sortera widgetar på denna sida, dra dem uppåt eller nedåt.'
|
||||
SilverStripe\Widgets\Model\Widget:
|
||||
PLURALNAME: Widgets
|
||||
SINGULARNAME: Widget
|
||||
SilverStripe\Widgets\Model\WidgetArea:
|
||||
PLURALNAME: Widgetområden
|
||||
SINGULARNAME: Widgetområde
|
||||
WidgetDescription_ss:
|
||||
CLICKTOADDWIDGET: 'Klicka för att lägga till denna widget'
|
||||
WidgetEditor_ss:
|
||||
|
|
12
lang/zh.yml
12
lang/zh.yml
|
@ -1,16 +1,16 @@
|
|||
zh:
|
||||
SilverStripe\Widgets\Model\Widget:
|
||||
PLURALNAME: 小工具
|
||||
SINGULARNAME: 小工具
|
||||
SilverStripe\Widgets\Model\WidgetArea:
|
||||
PLURALNAME: 小工具区域
|
||||
SINGULARNAME: 小工具区域
|
||||
SilverStripe\Widgets\Forms\WidgetAreaEditor_ss:
|
||||
AVAILABLE: 可用的小工具
|
||||
AVAILWIDGETS: 点击下方的小工具名称即可在此页上使用。
|
||||
INUSE: 当前使用的小工具
|
||||
NOAVAIL: 目前没有可用小工具。
|
||||
TOSORT: 要对本页当前使用的小工具进行排序,请像上下拖拽。
|
||||
SilverStripe\Widgets\Model\Widget:
|
||||
PLURALNAME: 小工具
|
||||
SINGULARNAME: 小工具
|
||||
SilverStripe\Widgets\Model\WidgetArea:
|
||||
PLURALNAME: 小工具区域
|
||||
SINGULARNAME: 小工具区域
|
||||
WidgetDescription_ss:
|
||||
CLICKTOADDWIDGET: 点击添加该小工具
|
||||
WidgetEditor_ss:
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
zh_CN:
|
||||
SilverStripe\Widgets\Forms\WidgetAreaEditor_ss:
|
||||
AVAILABLE: 有效插件
|
||||
AVAILWIDGETS: 点击一个插件标题应用在当前页面
|
||||
INUSE: 当前已使用插件
|
||||
NOAVAIL: 当前无有效插件
|
||||
TOSORT: 请上下拖动当前页面的对应插件进行排序
|
||||
SilverStripe\Widgets\Model\Widget:
|
||||
PLURALNAME: 插件
|
||||
SINGULARNAME: 插件
|
||||
SilverStripe\Widgets\Model\WidgetArea:
|
||||
PLURALNAME: 插件区域
|
||||
SINGULARNAME: 插件区域
|
||||
WidgetDescription_ss:
|
||||
CLICKTOADDWIDGET: 点击增加该插件
|
||||
WidgetEditor_ss:
|
||||
DELETE: 删除
|
|
@ -2,6 +2,9 @@
|
|||
<ruleset name="SilverStripe">
|
||||
<description>CodeSniffer ruleset for SilverStripe coding conventions.</description>
|
||||
|
||||
<file>src</file>
|
||||
<file>tests</file>
|
||||
|
||||
<rule ref="PSR2">
|
||||
<!-- Current exclusions -->
|
||||
<exclude name="PSR1.Methods.CamelCapsMethodName"/>
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<phpunit bootstrap="vendor/silverstripe/cms/tests/bootstrap.php" colors="true">
|
||||
<testsuite name="Default">
|
||||
<directory>tests</directory>
|
||||
</testsuite>
|
||||
|
||||
<testsuites>
|
||||
<testsuite name="Default">
|
||||
<directory>tests</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
<filter>
|
||||
<whitelist addUncoveredFilesFromWhitelist="true">
|
||||
<directory suffix=".php">src/</directory>
|
||||
|
|
|
@ -66,7 +66,7 @@ class WidgetAreaEditor extends FormField
|
|||
$available = Config::inst()->get($class, 'only_available_in');
|
||||
|
||||
if (!empty($available) && is_array($available)) {
|
||||
if (in_array($this->Name, $available)) {
|
||||
if (in_array($this->Name, $available ?? [])) {
|
||||
$widgets->push(singleton($class));
|
||||
}
|
||||
} else {
|
||||
|
@ -168,12 +168,12 @@ class WidgetAreaEditor extends FormField
|
|||
if (empty($newWidgetData['Type'])) {
|
||||
$newWidgetData['Type'] = '';
|
||||
}
|
||||
$newWidgetData['Type'] = str_replace('_', '\\', $newWidgetData['Type']);
|
||||
$newWidgetData['Type'] = str_replace('_', '\\', $newWidgetData['Type'] ?? '');
|
||||
|
||||
// create a new object
|
||||
if (!$widget
|
||||
&& !empty($newWidgetData['Type'])
|
||||
&& class_exists($newWidgetData['Type'])
|
||||
&& class_exists($newWidgetData['Type'] ?? '')
|
||||
&& is_subclass_of($newWidgetData['Type'], Widget::class)
|
||||
) {
|
||||
$widget = Injector::inst()->create($newWidgetData['Type']);
|
||||
|
|
|
@ -13,6 +13,7 @@ use SilverStripe\Forms\TextField;
|
|||
use SilverStripe\ORM\DataObject;
|
||||
use SilverStripe\ORM\FieldType\DBHTMLText;
|
||||
use SilverStripe\Versioned\Versioned;
|
||||
use SilverStripe\View\SSViewer;
|
||||
|
||||
/**
|
||||
* Widgets let CMS authors drag and drop small pieces of functionality into
|
||||
|
@ -116,7 +117,7 @@ class Widget extends DataObject
|
|||
*/
|
||||
public function Content()
|
||||
{
|
||||
return $this->renderWith(array_reverse(ClassInfo::ancestry(__CLASS__)));
|
||||
return $this->renderWith(SSViewer::get_templates_by_class(static::class));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -190,7 +191,7 @@ class Widget extends DataObject
|
|||
if ($value) {
|
||||
$field->setValue($value);
|
||||
}
|
||||
$namefiltered = preg_replace("/([A-Za-z0-9\-_]+)/", "Widget[" . $this->FormID . "][\\1]", $name);
|
||||
$namefiltered = preg_replace("/([A-Za-z0-9\-_]+)/", "Widget[" . $this->FormID . "][\\1]", $name ?? '');
|
||||
|
||||
$field->setName($namefiltered);
|
||||
$outputFields->push($field);
|
||||
|
@ -229,14 +230,14 @@ class Widget extends DataObject
|
|||
return $this->controller;
|
||||
}
|
||||
|
||||
foreach (array_reverse(ClassInfo::ancestry(get_class($this))) as $widgetClass) {
|
||||
foreach (array_reverse(ClassInfo::ancestry(get_class($this)) ?? []) as $widgetClass) {
|
||||
$controllerClass = "{$widgetClass}Controller";
|
||||
if (class_exists($controllerClass)) {
|
||||
if (class_exists($controllerClass ?? '')) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!class_exists($controllerClass)) {
|
||||
if (!class_exists($controllerClass ?? '')) {
|
||||
throw new Exception('Could not find controller class for ' . static::class);
|
||||
}
|
||||
|
||||
|
@ -267,7 +268,7 @@ class Widget extends DataObject
|
|||
|
||||
//Look for checkbox fields not present in the data
|
||||
foreach ($fields as $field) {
|
||||
if ($field instanceof CheckboxField && !array_key_exists($field->getName(), $data)) {
|
||||
if ($field instanceof CheckboxField && !array_key_exists($field->getName(), $data ?? [])) {
|
||||
$field->setValue(false);
|
||||
$field->saveInto($this);
|
||||
}
|
||||
|
|
|
@ -106,7 +106,7 @@ class WidgetController extends Controller
|
|||
*/
|
||||
public function Content()
|
||||
{
|
||||
return $this->renderWith(array_reverse(ClassInfo::ancestry(get_class($this->widget))));
|
||||
return $this->renderWith(array_reverse(ClassInfo::ancestry(get_class($this->widget)) ?? []));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -136,8 +136,8 @@ class WidgetController extends Controller
|
|||
$leftandmain->doInit();
|
||||
|
||||
// Decode if fully qualified - @see Widget::ClassName
|
||||
$className = str_replace('_', '\\', $this->urlParams['ID']);
|
||||
if (class_exists($className) && is_subclass_of($className, Widget::class)) {
|
||||
$className = str_replace('_', '\\', $this->urlParams['ID'] ?? '');
|
||||
if (class_exists($className ?? '') && is_subclass_of($className, Widget::class)) {
|
||||
$obj = new $className();
|
||||
return $obj->EditableSegment();
|
||||
} else {
|
||||
|
|
|
@ -15,7 +15,7 @@ class WidgetControllerTest extends FunctionalTest
|
|||
TestWidget::class,
|
||||
];
|
||||
|
||||
protected function setUp()
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
|
@ -32,7 +32,7 @@ class WidgetControllerTest extends FunctionalTest
|
|||
$response = $this->get($page->URLSegment);
|
||||
|
||||
$formAction = sprintf('%s/widget/%d/%s', $page->URLSegment, $widget->ID, 'Form');
|
||||
$this->assertContains(
|
||||
$this->assertStringContainsString(
|
||||
$formAction,
|
||||
$response->getBody(),
|
||||
"Widget forms are rendered through WidgetArea templates"
|
||||
|
@ -47,12 +47,12 @@ class WidgetControllerTest extends FunctionalTest
|
|||
$this->get($page->URLSegment);
|
||||
$response = $this->submitForm('Form_Form', null, array('TestValue' => 'Updated'));
|
||||
|
||||
$this->assertContains(
|
||||
$this->assertStringContainsString(
|
||||
'TestValue: Updated',
|
||||
$response->getBody(),
|
||||
"Form values are submitted to correct widget form"
|
||||
);
|
||||
$this->assertContains(
|
||||
$this->assertStringContainsString(
|
||||
sprintf('Widget ID: %d', $widget->ID),
|
||||
$response->getBody(),
|
||||
"Widget form acts on correct widget, as identified in the URL"
|
||||
|
|
Loading…
Reference in New Issue