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

Imported fieldsets are hardcoded when blueprint is saved #2157

Closed
mikemartin opened this issue Jul 30, 2020 · 3 comments
Closed

Imported fieldsets are hardcoded when blueprint is saved #2157

mikemartin opened this issue Jul 30, 2020 · 3 comments

Comments

@mikemartin
Copy link

Bug Description

When saving a blueprint, it looks like the imported fieldsets and inferred fields (like title, slug, parent, SEO Pro) are hardcoded into the blueprint.

Here's my original blueprint.

title: 'Podcast Page'
sections:
  main:
    display: Main
    fields:
      -
        handle: description
        field:
          type: textarea
          localizable: false
          listable: hidden
          display: Description
      -
        import: content
  cta:
    display: CTA
    fields:
      -
        import: cta
        prefix: cta_
  sidebar:
    display: Sidebar
    fields:
      -
        handle: author
        field:
          type: users
          display: Author
          default: current
          localizable: true
          max_items: 1

How to Reproduce

Edit and save a blueprint with imported fields and an addon like SEO Pro addon installed.
Blueprint after saving:

title: 'Podcast Page'
sections:
  main:
    display: Main
    fields:
      -
        handle: title
        field:
          type: text
          required: true
      -
        handle: description
        field:
          type: textarea
          localizable: false
          listable: hidden
          display: Description
      -
        handle: content
        field:
          sets:
            toc:
              display: TOC
              fields:
                -
                  handle: title
                  field:
                    display: Title
                    type: text
                -
                  handle: list
                  field:
                    type: list
                    display: List
            ticks:
              display: Ticks
              fields:
                -
                  handle: ticks
                  field:
                    type: list
                    display: Ticks
                -
                  handle: two_column
                  field:
                    type: toggle
                    localizable: false
                    listable: hidden
                    display: 'Two Column'
            links:
              display: Links
              fields:
                -
                  handle: links
                  field:
                    mode: table
                    type: grid
                    localizable: false
                    listable: hidden
                    add_row: 'Add Link'
                    fields:
                      -
                        handle: label
                        field:
                          type: text
                          display: Label
                      -
                        handle: link
                        field:
                          input_type: text
                          type: link
                          localizable: false
                          listable: hidden
                          display: Link
                          prepend: URL
            video:
              display: Video
              fields:
                -
                  handle: video
                  field:
                    type: video
                    localizable: false
                    listable: hidden
                    display: Video
                -
                  handle: full_width
                  field:
                    type: toggle
                    display: 'Full width'
                    width: 33
                -
                  handle: caption
                  field:
                    input_type: text
                    type: text
                    localizable: false
                    listable: hidden
                    display: Caption
                    width: 66
            image:
              display: Image
              fields:
                -
                  handle: image
                  field:
                    mode: grid
                    restrict: false
                    folder: articles
                    allow_uploads: true
                    max_files: 1
                    type: assets
                    localizable: false
                    listable: hidden
                    display: Image
                -
                  handle: position
                  field:
                    type: select
                    display: Position
                    clearable: true
                    width: 33
                    options:
                      left: Left
                      right: Right
                      full-width: 'Full Width'
                -
                  handle: crop
                  field:
                    type: select
                    display: Crop
                    width: 33
                    clearable: true
                    options:
                      square: Square
                -
                  handle: caption
                  field:
                    input_type: text
                    type: text
                    localizable: false
                    listable: hidden
                    display: Caption
                    width: 66
            pull_quote:
              display: 'Pull Quote'
              fields:
                -
                  handle: quote
                  field:
                    type: textarea
                    display: Quote
                -
                  handle: position
                  field:
                    type: select
                    clearable: true
                    display: Position
                    width: 33
                    options:
                      left: Left
                      right: Right
                -
                  handle: tweet
                  field:
                    width: 33
                    type: toggle
            reviews:
              display: Reviews
              fields:
                -
                  import: reviews
            button:
              display: Button
              fields:
                -
                  handle: label
                  field:
                    width: 33
                    input_type: text
                    type: text
                    localizable: false
                    listable: hidden
                    display: Label
                -
                  handle: link
                  field:
                    width: 33
                    input_type: text
                    type: text
                    localizable: false
                    listable: hidden
                    display: Link
                -
                  handle: color
                  field:
                    width: 33
                    type: color_swatches
                    display: Color
                    colors:
                      -
                        label: accent
                        value: '#189DC9'
                      -
                        label: primary
                        value: '#EF4830'
                      -
                        label: secondary
                        value: '#F4F4F4'
                    listable: hidden
                    default: accent
            call_to_action:
              display: 'Call to action'
              fields:
                -
                  import: call_to_action
          buttons:
            - h1
            - h2
            - h3
            - bold
            - italic
            - unorderedlist
            - orderedlist
            - removeformat
            - quote
            - anchor
            - image
            - table
            - h4
            - h5
            - h6
            - code
            - codeblock
          save_html: false
          toolbar_mode: fixed
          link_noopener: false
          link_noreferrer: false
          target_blank: false
          reading_time: true
          fullscreen: true
          allow_source: true
          type: bard
          localizable: false
          listable: hidden
          container: assets
          display: Content
  cta:
    display: CTA
    fields:
      -
        import: cta
        prefix: cta_
  sidebar:
    display: Sidebar
    fields:
      -
        handle: author
        field:
          type: users
          display: Author
          default: current
          localizable: true
          max_items: 1
      -
        handle: slug
        field:
          type: slug
          required: true
          localizable: true
      -
        handle: parent
        field:
          type: entries
          collections:
            - pages
          max_items: 1
          listable: false
  SEO:
    display: SEO
    fields:
      -
        handle: seo
        field:
          type: seo_pro
          fields:
            -
              handle: enabled
              field:
                display: Enabled
                instructions: 'Disabling this section will exclude it from reports and the sitemap, and prevent anything from being rendered through the template tag.'
                type: toggle
                default: true
            -
              handle: title
              field:
                display: 'Meta Title'
                instructions: 'Pick an existing field to set as this section''s **default** meta title.'
                placeholder: 'Want the Best - Freelance Clients?'
                type: seo_pro_source
                disableable: true
                field:
                  type: text
            -
              handle: description
              field:
                display: 'Meta Description'
                instructions: 'Pick an existing field to set as this section''s **default** meta description.'
                placeholder: 'If so, you need a lead generation system that alerts you when leads appear. I''ll show you how to set it up to find the right leads and bring them directly to you.'
                type: seo_pro_source
                field:
                  type: text
            -
              handle: site_name
              field:
                display: 'Site Name'
                instructions: 'Optionally disable the site name for this section.'
                placeholder: 'Jason Resnick'
                type: seo_pro_source
                from_field: false
                disableable: true
                field: false
            -
              handle: site_name_position
              field:
                display: 'Site Name Position'
                instructions: 'Optionally adjust the position for this section.'
                placeholder: after
                type: seo_pro_source
                from_field: false
                field:
                  type: select
                  options:
                    after: After
                    before: Before
                    none: Disable
            -
              handle: robots
              field:
                display: Robots
                instructions: 'Pick options for the robots meta tag. noindex prevents the page being indexed by search engines. nofollow prevents search engines from crawling links.'
                placeholder: null
                type: seo_pro_source
                from_field: false
                disableable: true
                field:
                  type: select
                  create: true
                  options:
                    - noindex
                    - nofollow
            -
              handle: image
              field:
                display: Image
                instructions: 'Choose a default image field to represent each URL in this section when shared on social networks.'
                placeholder: false
                type: seo_pro_source
                allowed_fieldtypes:
                  - assets
                field: false
            -
              handle: sitemap
              field:
                display: Enabled
                instructions: 'If disabled, items in this section will not appear in the sitemap.'
                placeholder: null
                type: seo_pro_source
                disableable: true
                field: false
            -
              handle: priority
              field:
                display: Priority
                instructions: 'The priority of these URLs relative to other URLs on your site. Valid values range from `0.0` to `1.0`.'
                placeholder: 0.5
                type: seo_pro_source
                field:
                  type: text
            -
              handle: change_frequency
              field:
                display: 'Change Frequency'
                instructions: 'A hint to search engines on how frequently the pages in this section are likely to change.'
                placeholder: monthly
                type: seo_pro_source
                field:
                  type: select
                  options:
                    hourly: Hourly
                    daily: Daily
                    weekly: Weekly
                    monthly: Monthly
                    yearly: Yearly
                    never: Never

Extra Detail

Environment

Statamic version: 3.0.0.-beta-{?}

PHP version: 7.{?}

Install method (choose one):

  • Fresh install from statamic/statamic
  • Starter kit
  • Existing Laravel app
  • Other (please explain this magic!)
@Rovaski
Copy link

Rovaski commented Jul 30, 2020

I too have this happening.
However, not every imported fieldset gets saved(hardcoded as you say)

It seems just the fieldset with title/author/slug, etc is affected

@jasonvarga
Copy link
Member

Looking into this one now. It looks like they are brought inline when you visit the edit screen. The YAML will only be updated if you hit save.

@andjsch
Copy link
Contributor

andjsch commented Jul 31, 2020

Can reassure. The first time, the fieldset is linked, it appears just like it should:

-
  import: s_e_o
  prefix: seo_

After leaving the blueprint edit screen and reopening it, the fieldset's field are hardcoded. Only after hitting save though. But visually they appear already as if they were hardcoded.

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

4 participants