silverstripe / silverstripe-widgets Goto Github PK
View Code? Open in Web Editor NEWWidgets subsystem for Silverstripe CMS
Home Page: http://silverstripe.org
License: BSD 3-Clause "New" or "Revised" License
Widgets subsystem for Silverstripe CMS
Home Page: http://silverstripe.org
License: BSD 3-Clause "New" or "Revised" License
Hi,
I've got the CWP basic recipe installed and have installed a few modules. I've got the widgets module installed (currently named "silverstripe-widgets"). Widgets appear but are not clickable or dragable.
Another topic suggested I rename the folder to "widgets" (and run dev/build). After doing this I go to my widget section to find that there are no longer any widgets there.
Does anybody have any suggestions?
Thanks.
SS3.1.2-rc2
widgets - master branch, last commit: 2c08c17
To reproduce:
-Clean install w/ widgets module only, add generic Page extension
-Duplicate any page (not necessary to actually add any widgets)
-Delete draft (or save & publish, unpublish, delete draft)
*Notice appears, CMS SiteTree hierarchy controls disappear until browser cache flush (which often requires closing the tab or whole browser)
Maybe related to versioning?
Trace:
https://gist.github.com/clyonsEIS/1062e28c596ef6980ec0
Problem was tracked down to AvailableWidgets();
Current declaration:
public function AvailableWidgets() {
$widgets= new ArrayList();
foreach($this->widgetClasses as $widgetClass) {
$classes = ClassInfo::subclassesFor($widgetClass);
array_shift($classes);
foreach($classes as $class) {
$widgets->push(singleton($class));
}
}
return $widgets;
}
Raw fix:
public function AvailableWidgets() {
$widgets= new ArrayList();
foreach($this->widgetClasses as $widgetClass) {
$classes = ClassInfo::subclassesFor($widgetClass);
if(count($classes) > 1) array_shift($classes);
foreach($classes as $class) {
$widgets->push(singleton($class));
}
}
return $widgets;
}
I see this is for 3.1.. can we still get to the 3.0 branch?
If you have a has_many relationship, it fails to work and show a tab to select from existing data object. Even if you try to add it "manually" in getCMSFields(), it still doesnt work, throwing errors like: Fatal error: Call to a member function FormAction() on a non-object in .... framework\forms\FormField.php on line 161
I use Silverstripe 3.0.3 stable release with the widgetmodule.
I've created several widgets wich function properly when used on a page.
But when I add several widgets to the same page the second widget fails.
I found out the functions are not being called of the second widget or that the objects not exist.
On this forum I also found this forum item:
http://www.silverstripe.org/widgets-2/show/20989
this seem to be the same problem.
Next to puting 2 widgets into one widgetarea, I also tried putting 2 widgetareas (each with one widget).
But that doesn't help.
It seems like 2 or more widgets on a page aren't possible.
Please! Make it work!!!!
The project we are working on, we stop working on upgrading the SS on the old site, but keen on build a new one with latest SS and then move all content from the old site. Everything works fine, but when I implement the widgets module for blog by following the instruction below:
https://github.com/silverstripe/silverstripe-blog/tree/2.0.4
https://github.com/silverstripe/silverstripe-widgets/tree/1.1it does not work well, it shows every widget but not managable. It should be dragable, dropable and managable. And my feeling tells me maybe the JavaScript is not running. But I have no idea how to fix it.
The module can be improved by following the SilverStripe coding conventions more closely.
Adding a widget to a page or object, instantly results in given error.
I'm not sure if this is a problem with the widgets module or the blog module, but the 'Available Widgets' and 'Widgets Currently Used' areas are doubling up in Admin on the blog page type (see screen grab below).
This is a vanilla SS 3.0.5 install with the blog, comments and widgets modules installed. It's using the Simple theme.
Is it possible to have validation for the fields found in the CMS for a specific widget.
I have tried the usual method for each Dataobject but it doesn't seem to be working.
public function getCMSValidator(){
}
Normally when a field in the CMS is changed the save / save & publish buttons change to highlight that changes need to be saved.
This does not happen when widgets are changed
Steps:
Start with no Used Widgets
Drag a Widget over, click Save and Publish
Delete the Widget you just added, click Save and Publish
You can no longer drag add new widgets until you refresh the page
This bug (http://open.silverstripe.org/ticket/6288) has not been addressed yet.
Using SS 3.0.3, this module cloned today, and the blog module 0.6(the latest?).
I get the following error in CMS when try to select the blog holder page:
[User Error] Uncaught Exception: DataObject->getComponent(): Could not find component 'SideBar'.
GET /admin/pages/edit/show/6
Line 1324 in /var/www/vhosts/berzerkdev.com/berzerk/framework/model/DataObject.php
Source
1315 if($joinID) {
1316 $component = DataObject::get_one($class, ""$joinField" = $joinID");
1317 }
1318
1319 if(!isset($component) || !$component) {
1320 $component = $this->model->$class->newObject();
1321 $component->$joinField = $this->ID;
1322 }
1323 } else {
1324 throw new Exception("DataObject->getComponent(): Could not find component '$componentName'.");
1325 }
1326
1327 $this->components[$componentName] = $component;
1328 return $component;
1329 }
1330
Some thing to do with side bar?
ArchiveWidget for blog module is not translatable. Its hardcoded to "Browse by Date".
Temporary solution (as suggested by Pyromanik on irc chat) is to add to _config.php:
ArchiveWidget::$title = "Whatever 'browse by date' is in your language";
The problem (as simon_w pointed) is Widget::Title() doesn't go through _t()
i guess there is a "d" missing in Widget:
https://github.com/silverstripe/silverstripe-widgets/blob/master/code/controller/WigetContentControllerExtension.php
Per the @wilr's comment in #85 the DB=MYSQL CORE_RELEASE=3 build is failing, at first I thought changing WidgetArea::ItemsToRender() to use filter() would solve the deprecation issues and allow the build to finish but it would seem that just moves to the next issue. Which is bellow, it would seem as though the silverstripe/framework 3 branch has a deprecation on has_one(). If it doesn't disappear the build log can be seen here https://travis-ci.org/webbuilders-group/silverstripe-widgets/jobs/56909007
WidgetControllerTest::testWidgetFormSubmission
DataObject->has_one is deprecated. Please use hasOne() instead. Called from WidgetContentControllerExtension->handleWidget.
Please add WidgetAreaEditor.js and WidgetAreaEditor.css into the archive as from B2 they are missing from the cms along with widget support
Personally I think its a shame widgets are now modules.
Anyway this is now the relevant function in WidgetAreaEditor.php with the js and css moved:
function FieldHolder($properties = array()) {
Requirements::css('silverstripe-widgets/css/WidgetAreaEditor.css');
Requirements::javascript(THIRDPARTY_DIR . "/prototype/prototype.js");
Requirements::javascript(THIRDPARTY_DIR . '/behaviour/behaviour.js');
Requirements::javascript('silverstripe-widgets/javascript/WidgetAreaEditor.js');
return $this->renderWith("WidgetAreaEditor");
}
It would be neat to a have a CMS Report that tells me which widgets are used and on which pages they are used.
Migrated from http://open.silverstripe.org/ticket/6470
Adding widgets to the homepage in one language are not recognized in the non-default language. Fix is to add this code to sapphire/widgets/Widget.php . See http://www.silverstripe.org/widgets-2/show/11375
function onBeforeWrite() {
parent::onBeforeWrite();
// Set locale from the currently choosen language locale
if ($this->Locale != Translatable::get_current_locale()) $this->Locale = Translatable::get_current_locale();
}
WidgetHolder.ss has a $Content variable, which is the place where the Widget template is rendered. I find this to be a bit inconsistent with the use of $Content in page templates. IE you usually expect it to be a HTMLText field.
I want to propose changing this to something else, in WidgetHolder and the corresponding function in Widget.php. The only issue I can see in causing upgrade issues is in the case where someone has implemented their own WidgetHolder.ss tempate.
I've tentatively changed $Content to $Render in my local code.
Thoughts?
introduced here #52
The current UI for handling the widgets in the CMS is does not fit the SS 3.0.
I was trying to return a function in my widget to display certain members. However, when I put this in MyWidget and looped through it in the widget template I did not get any results.
However, putting the function to get the members in the MyWidget_controller, it all worked!
More info: http://www.silverstripe.org/widgets-2/show/22718 (with code and stuff).
Not sure if this is an issue though, perhaps it is maybe it should be like this
Widgets dont seem to work when there is more than one. No idea why, abandoning the use of widgets because there seem to be too many pitfalls.
Sorry im new here - how would i allow widgets in footer?
I have my widgets created ie latest blog posts and gallery which work in sidebar...but stuck on footer?
Stef
While inside the template of a widget it is impossible to use <% loop Children %>, or when using a has_one relationship to page to do <% with HasOnePage %>.
This is the error message:
Fatal error: Call to a member function FormAction() on a non-object in /framework/forms/FormField.php on line 139
To reproduce:
public function getCMSFields() {
return new FieldList(
$imageField = new UploadField('Image', 'Upload image');
):
}
SS 3.0.3:
i assigned a widgetarea to a page and have 2 widgets available.
the widgets work but i cant open the page over the sitetree in admin because the ajax call wont terminate properly: just before the last the script seems to die and the json is not valid.
the server returns a 200 however!?
when reload the page or enter the url (/admin/pages/edit/show/7) i can access the page in admin!?
and the widgets tab with the widgets is shown.
any ideas?
There is possible include history (versions) of changes in widgets? Like some history pages....
When checking out sapphire and cms 3.1-branch, widgets no longer work. When switch back to sapphire and cms 3.0-branch it works again. Error that I receive is on all widgets, for example: website.com/Widget_Controller/EditableSegment/ArchiveWidget results in 404-not-found.
Widget.php Lines 121, 129, 137
Thanks,
Regards,
Jose A.
When you add a new widget to the widgetarea it's put on top,
but after you save the page it's shown at bottom.
Easy fix: In /widget/javascript/WidgetAreaEditor, row 135, change:
('#usedWidgets-'+$(this).attr('name')).prepend(widgetContent);
To:
('#usedWidgets-'+$(this).attr('name')).append(widgetContent);
I have tried this on an old site and a fresh install.
I have tried using widgets both the old way, and using the new
Page:
extensions:
- WidgetPageExtension
method in my main config.yml file in mysite/_config
I can’t add widgets to a page using 3.1 and widgets. They have both been installed using Composer. When I click on the [+] button the CMS attempts to access url.com/WidgetController/EditableSegment/nameofWidget but gets a 404 error.
Any widgets already on the page work as expected.
If I use composer to roll back to 3.0.x everything works as expected again.
Tags are useful for module versioning, please start deploying versions
Version 0.6.2 of the blog module can't be installed on SS 3.0.x using Composer as it requires silverstripe/widgets dev-master which in turn requires silverstripe/cms >= 3.1
See silverstripe/silverstripe-blog#84 for the related bug report on the blog module.
Alright, just did a clean install of SS 3.0.2 with the Blog (v0.6) and Widgets (v0.1) modules installed. Both modules were downloaded from the most recent master branch on GitHub. After that, if I attempt to edit a blog holder page, I get the following error while in dev mode:
Error at line 1304 of /framework/model/DataObject.php
Also, it appears that the Widgets module doesn't work at all. Not sure which module is the culprit but, either way, it's definitely a problem. :/
I have included the widgetArea on a vanilla SS3.0.* according the readme and integrated
$MyWidgetArea in Page.ss.
The widget i used is my fork of the loginwidget:
https://github.com/ivoba/silverstripe-widget-login
But the widget wont show.
If i integrated it directly with new LoginWidget() instead of WidgetArea it works.
Is this a problem of the widget or of this module?
Can you give me a hint where i can debug the rendering of $MyWidgetArea?
I get the following error when there are no widgets to return
[User Error] Uncaught LogicException: filter can't be called on an UnsavedRelationList
Trace
UnsavedRelationList->filter(Enabled,1)
WidgetArea.php:59
WidgetArea->ItemsToRender()
WidgetArea.php:33
WidgetArea->WidgetControllers()
ViewableData.php:402
Using SS 3.2.3 and widgets 1.2.*@dev
Widgets are not showing on my page.
I have installed the Widget Modules
Created the flickerWidget and the widget added to Default Sidebar widgetArea
flickerfleds like PhotSet,UserID is set.
page.ss
<% include SideBar %>
<div class="content-container unit size3of4 lastUnit">
<article>
<h1>$Title</h1>
<div class="content">$Content</div>
</article>
$Form
$PageComments
<% loop $WidgetArea("Sidebar") %>
$WidgetHolder
<% end_loop %>
</div>
it is not showing the Flicker widget.
There are a couple of links to http://www.silverstripe.org/widgets in README.md, the page no longer exists on the SilverStripe website.
When using the CMS to duplicate a page, the WidgetArea
that is linked to the new instance is the exact same instance as the origianal page.
Original ticket: http://open.silverstripe.org/ticket/8348
When more than about 8 widgets are installed (through being on the file system), the left hand side of "available widgets" in the CMS creates a scroll bar, but you cannot drag the items to the right.
I suggest making the left and right hand side have independent scrollbars when they exceed their heights.
Secondly, if you drag the widget to any place underneath the right hand side, let it stick. Currently, you must drag it very close to an existing installed widget, which is poor usability.
They are sadly missing? I'm willing to start a german translation, trouble is: I have no idea how to do that. Some pointers in that direction would be appreciated.
I guess its still under developement but at the moment the widgets selection in the cms looks broken. Not only that it looks not styled, you cant add or remove widgets.
screenshot: http://imagebin.org/228001
If I am not wrong the WidgetHolder.ss template is used within the WidgetArea.ss template to wrap the Widgets added to a page:
Here is the WidgetArea.ss
<% loop WidgetControllers %>
$WidgetHolder
<% end_loop %>
and the WidgetHolder.ss:
<div class="WidgetHolder $ClassName<% if FirstLast %> $FirstLast<% end_if %>">
<% if Title %><h3>$Title</h3><% end_if %>
$Content
</div>
But if I add $Pos or $TotalItems to the latter the value for both position indicators is always 1 (for all Widgets added - I added 3). This came to my attention because the line
<% if FirstLast %> $FirstLast<% end_if %>
added "first last" every time (in my case for all 3 Widgets).
The documentation points out
$FirstLast: Returns a string, "first", "last", "first last" (if both), or "". Useful for CSS classes.
If it is intended like that how should the logic for
<% if FirstLast %> $FirstLast<% end_if %>
work?
When click in tab widgets (on page type Blog Entry Page) don't show anything...
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.