Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Presentation #10

Open
webbird opened this issue Aug 19, 2021 · 2 comments
Open

Presentation #10

webbird opened this issue Aug 19, 2021 · 2 comments

Comments

@webbird
Copy link
Contributor

webbird commented Aug 19, 2021

I just stumbled across your new library and like the humor. :) Good work so far!
Are you going to implement some kind of "presentation layer"? What I mean is: A user can choose a "flavor" like "Bootstrap" or similar and the lib just adds the appropriate class names to the elements. I know that this is not much fun, but I think it would help to create good looking forms with nearly no effort.

Edit: I think the "flavor" would / should / could make use of already existing methods like $x->setBeforeEach('<div class="form-row">')

You could also name it "topping" so it makes more sense if the user calls it at the end of the form creation. :D

@soatok
Copy link
Owner

soatok commented Aug 25, 2021

Yes, this is something I want to do.

We already have Blends e.g. https://github.com/soatok/cupcake/blob/master/src/Blends/MultiCheckbox.php

Before I get to the higher-level presentation stuff, I wanted to make sure the low-level functionality covers 100% of the HTML5 Form specification. Then, I want to make it easy to dive in and manage these elements (think jQuery versus 2008-era vanilla JavaScript). Once the utility is completely implemented, my next focus was going to be on convenience methods.

@webbird
Copy link
Contributor Author

webbird commented Aug 25, 2021

This is great news! I am interested in replacing my own FormBuilder, and Cupcake is the first alternative I like. :D

A special feature of my own form builder is the possibility to store the configuration of the form completely as an array. A field definition may look like this:

    array(
        'type'        => 'select',
        'label'       => 'Update frequency',
        'name'        => 'sitemap_update_freq',
        'options'     => array(
            'always', 'hourly', 'daily', 'weekly', 'monthly', 'yearly', 'never'
        ),
        'selected'    => 'weekly',
        'class'       => 'fbleave', // CSS class(es)
    )

There are more options like "required", "value" (set a default value), "allow" (attach validation) or even "title" (some description to be added as "title" attribute). Should be easy to create importers for Cupcake, first from JSON and PHP array. Later there can be importers from database and other sources, too. Would you prefer this to be a separate project? Are you interested anyway?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants