Comments (17)
Suggestion: ditch widgets and use Shea Dawson's blocks module for SS3 or elemental for SS4.
from silverstripe-widgets.
I'm also getting the same error using TreeDropdownField, should I open a separate bug for this?
from silverstripe-widgets.
Hi, sorry for the late reply, I've somehow disabled my github notifications.
Please do, even though the problem is basically the same for all of the more 'advanced' gridfields, it helps testing any solutions.
I've come as far realizing that the whole getCMSFields from Admin -> Page -> WidgetArea -> Widget doesn't work, and therefore some fields can't get hold on the actually Form or Controller.
What needs to be done is to refactor the whole thing. :/
from silverstripe-widgets.
That sounds like a big project!
I've noticed that lots of page functions don't seem to work with widgets, would this be something that would be included in a refactor? For example I wanted to get the URL from a Page ID by using $FooID.Link, but I had to write a custom function using SiteTree::get()->byID($pageID)->Link() instead.
from silverstripe-widgets.
Hi!
I'am using widgets for an upcoming project, and it is a must to enable the possibility of uploading images directly on widget creation. So I wanted to know if there are any news on that issue, if there's a workaround and if I may help somehow.
Could it also be, that has_many and many_many relations on widget do not work? I found out, that the according relation tables will not be created on /dev/build/
Thanks in advance,
Markus
from silverstripe-widgets.
Amo666, you can attach an image this way...http://pastebin.com/wKiHApmq
from silverstripe-widgets.
Hi! Thank's for the hint, I already did it that way, but it is not the solution I need. Our client needs a perfect usability, so a user should have the ability to upload an image directly on widget creation.
I now use "GridFieldAddNewMultiClass" from the gridfieldextensions by @ajshort for choosing
different widget classes. I use the standard silverstripe forms, so I can use standard formfields like the UploadField. Further I can generate a live preview of the widget in the Grid and on creation with a LiteralField. GridFieldOrderableRows enables Drag&Drop. That works for me.
from silverstripe-widgets.
I have created a module that somewhat encapsulates @amo666 's idea: https://github.com/burnbright/silverstripe-widgetpages.
In a nutshell:
$fields->removeByName("SideBar");
$fields->addFieldToTab("Root.Widgets",
GridField::create("SideBar","SideBar",
$this->SideBar()->Widgets(),
GridFieldConfig_RecordEditor::create()
->removeComponentsByType("GridFieldAddNewButton")
->addComponent(new GridFieldAddNewMultiClass())
->addComponent(new GridFieldOrderableRows())
)
);
from silverstripe-widgets.
I have created a module that transform @jedateach in an extension, and in addition to provide a workaround for this issue it give some enhancement to the original widget module, like many_many relationship instead of the original has_many and an alternative templating strategy. Here you are the link:
http://addons.silverstripe.org/add-ons/zirak/widget-pages-extension
from silverstripe-widgets.
Multiselect Module does not work inside widget
from silverstripe-widgets.
why has this important issue not been fixed for many years?
from silverstripe-widgets.
@nguyenhoanglong1331 since this issue is so old I imagine parts of it are no longer relevant. If youβre still experiencing this problem could you please provide us with your composer.json contents and some steps to reproduce?
from silverstripe-widgets.
Here is my composer.json
{
"name": "silverstripe/installer",
"type": "silverstripe-recipe",
"description": "The SilverStripe Framework Installer",
"require": {
"php": ">=5.6.0",
"silverstripe/recipe-plugin": "^1",
"silverstripe/recipe-cms": "1.1.1@stable",
"silverstripe-themes/simple": "~3.2.0",
"unclecheese/betterbuttons": "2.x-dev",
"silverstripe/widgets": "^2.0"
},
"require-dev": {
"phpunit/phpunit": "^5.7"
},
"extra": {
"branch-alias": {
"4.x-dev": "4.2.x-dev",
"dev-master": "5.x-dev"
},
"project-files-installed": [
"mysite/.htaccess",
"mysite/_config.php",
"mysite/_config/mysite.yml",
"mysite/code/Page.php",
"mysite/code/PageController.php"
],
"public-files-installed": [
".htaccess",
"index.php",
"install-frameworkmissing.html",
"install.php",
"web.config"
]
},
"config": {
"process-timeout": 600
},
"prefer-stable": true,
"minimum-stability": "dev"
}
and in the widget file
public function getCMSFields()
{
return new FieldList(
new HTMLEditorField('Paragraph', 'Content'),
new NumericField('MaxWidth', 'Max Width'),
new NumericField('PaddingBottom', 'Padding Bottom'),
new TextField('Color', 'Color'),
new TextField('BackgroundColor', 'Background Color'),
new UploadField('Photo','Photo')
//UploadFiled::create('Photo','Photo')
);
}
All the other fileds are working good, but when i put the UploadField, it throws an error
from silverstripe-widgets.
Thank you @nguyenhoanglong1331
from silverstripe-widgets.
+1 to this issue. I'm also using the solution with GridFieldAddNewMultiClass
for now, but it'd be awesome to use the original interface, which is much nicer.
from silverstripe-widgets.
public function getSchemaDataDefaults() { $defaults = parent::getSchemaDataDefaults(); $uploadLink = $this->Link('upload'); $defaults['data']['createFileEndpoint'] = [ 'url' => $uploadLink, 'method' => 'post', 'payloadFormat' => 'urlencoded', ]; $defaults['data']['maxFiles'] = $this->getAllowedMaxFileNumber(); $defaults['data']['multi'] = $this->getIsMultiUpload(); $defaults['data']['parentid'] = $this->getFolderID(); $defaults['data']['canUpload'] = $this->getUploadEnabled(); $defaults['data']['canAttach'] = $this->getAttachEnabled(); return $defaults; }
The issue happen because the input can not get the form when calling $this->Link('upload') function (file SilverStripe\AssetAdmin\Forms\UploadField.php)
Can anyone help me to get over it ?
from silverstripe-widgets.
@grandcreation you might have more luck if you move that problem into the silverstripe-asset-admin repository
from silverstripe-widgets.
Related Issues (20)
- Method 'getRequest' does not exist on 'SilverStripe\Forms\Form' HOT 4
- ENHANCEMENT Apply Versioned extension to Widget model (v4 only) HOT 3
- Fails to load compass HOT 9
- Widgets syncronize? HOT 2
- SS4 WidgetAreaEditor missing namespace HOT 2
- 500 fatal error when trying to add a widget to a page HOT 1
- Check and update module for SS4 compatibility where necessary HOT 1
- Rename HTML Content widget HOT 9
- Widget UX: Widgets appear on incompatible page types HOT 1
- Custom widget not being "Published" HOT 19
- Can't install for SS2.3 and blog2.5 HOT 1
- WidgetAreaID SQL error when adding WidgetArea to a child of Page HOT 7
- control tag is not working HOT 2
- DOCS README needs updating HOT 4
- [Warning] Invalid argument supplied for foreach() on 1.3 release running on SS 3.* HOT 2
- Split screen editing of widgets on a blog page shows TinyMCE too narrow HOT 5
- ListboxField not showing selected values HOT 8
- SS 4.5.1 Duplicate lits of 'Available Widgets' in Silverstripe backened. HOT 2
- Getting Widgets of Another Top Pages(This is Wrong) HOT 1
- Duplicating a page with Widgets doesn't assign new SideBarID HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from silverstripe-widgets.