Jump to content

PW 3.0.74 – FieldsetPage now in core


ryan
 Share

Recommended Posts

Last week we talked about new Fieldset modules for ProcessWire, and I was happy to hear about all the enthusiasm for these. In that post, we primarily looked at the new FieldtypeFieldsetGroup module in detail. This week we'll continue along a similar subject and look at the new FieldtypeFieldsetPage module. Actually we'll do more than look at it, we'll release it – it's now in ProcessWire core version 3.0.74, ready for you to use:

https://processwire.com/blog/posts/processwire-3.0.74-adds-new-fieldsetpage-field-type/

 

  • Like 10
Link to comment
Share on other sites

Hey @ryan loving these fieldset updates, keep them coming. I was holding myself not to start building a website until I can get my hands on these. Now having tried FieldtypeFieldsetPage, I've found it really useful for page meta (tags, categories etc) and SEO (seo title, desc) related fields.

I also have a bug to report. ProcessPageEditLink crashes when it tries to get the list of files (when adding a link with CKEditor). It can handle basic repeater and repeater matrix pages properly but not FieldtypeFieldsetPage, and I get this error:

edit.thumb.png.6b653ca0b3936d6ab75e64b7a2e6a9fb.png

Problem comes from this part. $repeaterPage is the id of repeater item, not a fully loaded Page instance.

protected function getFilesPage(Page $page, $prefix = '') {
    $files = array();
    foreach($page->template->fieldgroup as $field) {
        $type = $field->type;
        // ...
        } else if(wireInstanceOf($type, 'FieldtypeRepeater')) {
            $value = $page->get($field->name);
            if($value) foreach($page->get($field->name) as $repeaterPage){
                
                // repeater page is page id, not a Page instance!!
                $files = array_merge($this->getFilesPage($repeaterPage, $field->getLabel() . ': '), $files);
            }
        }
    }
    return $files;
}

For now, I'm skipping FieldtypeFieldsetPage using:

if(wireInstanceOf($type, 'FieldtypeFieldsetPage')) continue;

  • Like 3
Link to comment
Share on other sites

Since I read about the new fieldsets I'm thinking if it would make sense to have some kind of fieldset library. Maybe export jsons in github gists? Or maybe collect them just in a forum thread here...

This could make it more easy and more efficient to share common fieldsets, like SEO, person details or the like.

What do you guys think?

  • Like 8
Link to comment
Share on other sites

3 hours ago, bernhard said:

What do you guys think?

I strongly support it :) Some sort of organized way of doing it would be welcome. Maybe processwire-recipes.com could be used for this. processwire-recipes.com is not too updated these days and it has a somewhat confusing and "too many steps to follow" submitting+approval process.

Quote: "In the near future we plan to implement a contribution form right here to sync back to the GitHub repo."

Since the Universe is ageless, "near future" can be anything (in programming we call it Undefined :P ) however we could improve things a bit in this area.

  • Like 1
Link to comment
Share on other sites

On 2.9.2017 at 0:10 AM, abdus said:

I also have a bug to report. ProcessPageEditLink crashes when it tries to get the list of files (when adding a link with CKEditor). It can handle basic repeater and repeater matrix pages properly but not FieldtypeFieldsetPage, and I get this error:

I second that.

I cannot insert a link or edit a link in CKE on templates with FieldsetPage.

Link to comment
Share on other sites

23 minutes ago, Klenkes said:

The error occurs for me on pages with no repeater on it

There doesnt have to be a separate basic Repeater field. FieldtypeFieldsetPage extends Repeater fields, that's why the ProcessPageEditLink crashes. But with @ryan's fix, it's gone now ( just tried).

Link to comment
Share on other sites

Same here. I posted that in the blog comments already. I would like to see two things:

1. Be able to use this as a seperate tab (e.g. it's convenient to have all SEO related fields in a separate tab instead of mixed with the content)

2. Deprecation of fieldset (open). As far as I can see it the new fieldset types offer pretty much the same functionality but are much easier and faster to use

Link to comment
Share on other sites

FieldsetPage seems like the perfect answer to this question I posted a little while ago, is this the kind of situation it was done in aid of?

What I had been doing til now (based on chatter in that thread) was making RepeaterMatrixes, creating all the repeater items using a super user, then restricting access to the "move/copy/new" etc controls using CSS.

Link to comment
Share on other sites

  • 2 weeks later...

When exporting a FieldtypeFieldsetPage using Setup > Fields > Export, repeater fields appears empty. Other repeater types (at least RepeaterMatrix) seem to export fine

{
    "seo": {
        "id": 99,
        "type": "FieldtypeFieldsetPage",
        "flags": 0,
        // ...
        "repeaterFields": "", // empty
        "icon": "search",
        // ...
    }
}

 

Link to comment
Share on other sites

Just noticed that FieldtypeFieldsetPage doesn't seem to be compatible with RepeaterMatrix, has anyone tried using either of the new FieldtypeFieldset modules within a RepeaterMatrix yet?

EDIT
I'd created the FieldtypeFieldsetPage fields using the API in a migration file, seems that re-saving them via the admin GUI solved the problem.

Edited by ZGD
Solved Issue
Link to comment
Share on other sites

  • 2 weeks later...

Guess I'm lost. I just installed today's Dev release (3.0.77). I create my individual fields. I then go to create this new FieldsetPage field type, but it's not there. I have to choose Repeater, then FieldSet page becomes an option BUT ONLY AFTER the field has already been created. But once I switch over to FieldsetPage as the type of Repeater, it seems to break everything.

My understanding is that FieldsetPage allows me to take any fields and group them together for reuse. I can then assigned that fieldset to a template.

What am I missing?

Link to comment
Share on other sites

6 hours ago, Robin S said:

This fieldtype module is part of the core but it is not installed by default. Install it via Modules > Install > FieldtypeFieldsetPage

I already have it installed and it's dependencies. Ultimately, shouldn't it be as easy as:

  1. Create your individual fields.
  2. Assign those fields to the FieldsetPage field.
  3. Assign the FieldsetPage field to a template.
  4. Tada…the fields show up in the page edit/create screen.
Link to comment
Share on other sites

27 minutes ago, HMCB said:

I already have it installed and it's dependencies. Ultimately, shouldn't it be as easy as:

  1. Create your individual fields.
  2. Assign those fields to the FieldsetPage field.
  3. Assign the FieldsetPage field to a template.
  4. Tada…the fields show up in the page edit/create screen.

Yep - that's how it's working here for me.

 

18 hours ago, HMCB said:

But once I switch over to FieldsetPage as the type of Repeater, it seems to break everything.

Are you trying to convert an existing Repeater field to a FieldsetPage field? I bet that is the problem. It looks like it is available an a type to change a repeater field to, but the settings might not actually be compatible - @ryan ?

  • Like 1
Link to comment
Share on other sites

On 9/30/2017 at 10:16 AM, adrian said:

Yep - that's how it's working here for me.

 

Are you trying to convert an existing Repeater field to a FieldsetPage field? I bet that is the problem. It looks like it is available an a type to change a repeater field to, but the settings might not actually be compatible - @ryan ?

OK. This could have been an oversight on my end. I now see the FieldsetPage option in the dropdown when creating the field. My apologies.

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...