Giter VIP home page Giter VIP logo

Comments (17)

xini avatar xini commented on July 18, 2024 1

Suggestion: ditch widgets and use Shea Dawson's blocks module for SS3 or elemental for SS4.

from silverstripe-widgets.

MattyBalaam avatar MattyBalaam commented on July 18, 2024

I'm also getting the same error using TreeDropdownField, should I open a separate bug for this?

from silverstripe-widgets.

stojg avatar stojg commented on July 18, 2024

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.

MattyBalaam avatar MattyBalaam commented on July 18, 2024

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.

ShiftedBit avatar ShiftedBit commented on July 18, 2024

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.

greenbanana avatar greenbanana commented on July 18, 2024

Amo666, you can attach an image this way...http://pastebin.com/wKiHApmq

screen shot 2013-08-27 at 12 36 31 am

from silverstripe-widgets.

ShiftedBit avatar ShiftedBit commented on July 18, 2024

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.

jedateach avatar jedateach commented on July 18, 2024

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.

g4b0 avatar g4b0 commented on July 18, 2024

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.

blpraveen avatar blpraveen commented on July 18, 2024

Multiselect Module does not work inside widget

from silverstripe-widgets.

nguyenhoanglong1331 avatar nguyenhoanglong1331 commented on July 18, 2024

why has this important issue not been fixed for many years?

from silverstripe-widgets.

robbieaverill avatar robbieaverill commented on July 18, 2024

@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.

nguyenhoanglong1331 avatar nguyenhoanglong1331 commented on July 18, 2024

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.

robbieaverill avatar robbieaverill commented on July 18, 2024

Thank you @nguyenhoanglong1331

from silverstripe-widgets.

gdelavil avatar gdelavil commented on July 18, 2024

+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.

grandcreation avatar grandcreation commented on July 18, 2024
  
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.

robbieaverill avatar robbieaverill commented on July 18, 2024

@grandcreation you might have more luck if you move that problem into the silverstripe-asset-admin repository

from silverstripe-widgets.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.