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

[Bug] Custom Field Types Throw A Warning #6782

Closed
cdowdy opened this issue Jun 29, 2017 · 4 comments
Closed

[Bug] Custom Field Types Throw A Warning #6782

cdowdy opened this issue Jun 29, 2017 · 4 comments
Assignees
Milestone

Comments

@cdowdy
Copy link
Contributor

cdowdy commented Jun 29, 2017

An extension providing a custom field type following Providing New Field Types docs example will throw an alert with the warning:

In the ContentType for 'yourContentType', the field 'yourField' has 'type: yourType', which is not a proper field type. Please edit contenttypes.yml, and correct this.

Details

  • Relevant Bolt Version: [ 3.2.14+ ]
  • Install type: [ Zip Install & Composer install ]
  • PHP version: [ 7.0 ]
  • Used web server: [ Apache [2.4.18] | Nginx [1.10.2] ]
  • For UX/UI issues: [ browser name and version ]

Reproduction

  1. Bug summary:
    Custom field types throw a warning about not being a proper field type

  2. Specifics:

    • URL: any backend page while logged in will have the alert
    • Bolt 3.2.14
    • Composer and Zip Installs
    • Browsers: Chrome/Firefox/Edge all of em :)
    • Error Message:
      • In the ContentType for 'yourContentType', the field 'yourField' has 'type: yourType', which is not a proper field type. Please edit contenttypes.yml, and correct this.

      • bolt-custom-field-error
  3. Steps to reproduce:

    testField:
    name: TestFields
    singular_name: testField
    fields:
        title:
            type: text
            class: large
            group: content
        slug:
            type: slug
            uses: title
        web: # our field using custom type
            type: url # the custom type from Ross' example
            label: Enter a web address
    relations:
        pages:
          multiple: false
          order: title
          label: Select a page
    taxonomy: [ categories, tags ]
    record_template: entry.twig
    listing_template: listing.twig
    listing_records: 10
    default_status: publish
    sort: -datepublish
    recordsperpage: 10
  4. Expected result:

    • No warning to be thrown since everything functions "normally"
  5. Actual result:

    • a warning flashbag is thrown
@rossriley rossriley self-assigned this Jun 30, 2017
@bobdenotter bobdenotter added this to the Bolt 3.3 - Feature release milestone Jul 4, 2017
@mrenigma
Copy link

Just came across this issue myself on an older site using Bolt 3.2.6.

It doesn't affect repeaters but that may be because repeaters aren't checked in the checkConfig method?

I noticed that the relationlist field extension isn't affected and this uses the old way using registerFields(). So I assume it's because Bolt\Config is using the deprecated Storage\Field\Manager? Although I have no clue how to fix it 😄

@rossriley
Copy link
Contributor

Yes, that's right, the Config version works because the checks and the validator are in the same class, the problem is just one of load order, whereby in an attempt to decouple the field configuration from the fields themselves we've run into a condition where the config file is parsed before the additional fields in an extension are available.

We'll get a quick fix up soon, hopefully get it sorted today, the long term fix will be better as the Configuration system is being refactored at the moment for 3.4 and will be a bit more sophisticated than a massive array.

@rossriley
Copy link
Contributor

@gawainlynch scored a double bonus with this one, fixed with 280e454#diff-bb7d0af11f037a6468884c4e9371c46aL213

@GwendolenLynch
Copy link
Contributor

GwendolenLynch commented Jul 15, 2017

For historians, the PR was #6802

@rossriley you made my day with finding this one out, I must say! Thanks mate 👍

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

5 participants