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

Craft 5 support #11

Open
danethomas opened this issue Sep 8, 2024 · 11 comments
Open

Craft 5 support #11

danethomas opened this issue Sep 8, 2024 · 11 comments

Comments

@danethomas
Copy link

Craft 5 now supports a new Link field type craftcms/cms#9062 so support for this may no longer be required however before we migrate to that I was wondering if you've had a look at just adding Craft 5 to help with upgrading.

I tried to just change the craft/cms requirement but after the upgrade there seems to be a namespace issue:

{"errorMessage":"Unable to find component class 'statikbe\\cta\\fields\\CTAField'.","expectedType":"statikbe\\cta\\fields\\CTAField"

Any help would be appreicated

@janhenckens
Copy link
Member

Hey @danethomas, we've internally switched to using Hyper somwhere around Craft 4.7 and will not be porting this plugin to Craft 5.

We do however have a migration to Hyper (since we also have a bunch of sites on this plugin that will eventually need to be upgraded to 5) that's almost ready for release - which you can find here https://github.com/statikbe/craft-ctafield/tree/feature/hyper-migration

@danethomas
Copy link
Author

danethomas commented Sep 17, 2024

Excellent news!

I've tried that migration and both completed successfully but when viewing the content for one of the new Hyper fields I'm getting the following error.

Unable to render field - Undefined array key "CTA styles" /**/craft/vendor/statikbe/craft-config-values/src/fields/ConfigValuesFieldField.php:116

From what I can see all the older CTA fields are now Hyper ones but something hasn't gone right for the content migration. We're using Matrix & Neo fields rather than SuperTable. I can see that Matrix fields are supported in the migration, is the issue related to the Neo fields?

@danethomas
Copy link
Author

And we've got a new field
Screenshot 2024-09-18 at 10 58 33 AM

@janhenckens
Copy link
Member

In the "previous" plugin there was a button style option and we tried to add that to the new Hyper field. But I see I assumed that would always be done with https://github.com/statikbe/craft-config-values, which you might not have installed or configured.

Could you have a go at following the docs for that plugin and create a "CTA Styles" option here to see if that works?

@danethomas
Copy link
Author

Craft Config Value is installed but it wasn't clear how to configure it. The usage section in the readme is empty https://github.com/statikbe/craft-config-values/blob/develop/README.md

That said, I've added the following to craft/config/config-values-field.php an things appears to be displaying now.

<?php

return [
    'data' => ['CTA styles']
];

@danethomas
Copy link
Author

Is linkClasses only needed if we're using the older button style option. We were using that sporadically, but would prefer to remove it anyway, so just wondering if we should remove that first and then migrate.

Is Craft Config Values only required to support that? Also, is it needed, post migration?

Appreciate the help.

@janhenckens
Copy link
Member

Yeah, that's what its there for - but I'm not sure if the migration takes the usage or non-usage of the styles into account.

That's all the Config Values fields is used for yeah, so we might have to make all that optional.

Not sure when we'll be able to get to this though...

@danethomas
Copy link
Author

No problem at all - this has been hugely helpful.

We'll remove the classes and I'll try and do a migration without Config Values but I'm fairly sure we'll be good from here.

@janhenckens
Copy link
Member

Ok, let us know how you get on! Happy to update some code if you need this for multiple projects :)

@danethomas
Copy link
Author

Just an update - we're no longer blocked here.

There were checks to ensure config values was installed as part of the migration. For us - and potentially for others - we didn't really need support for the classes migration or they could have been moved directly into the classes attribute within the Hyper fieldgroup.

Thanks again - this was super helpful and the general migration of fieldtypes and content all worked great.

@janhenckens
Copy link
Member

Good to know the content migration works, we've only tested it on one smaller site and have yet to release the feature.

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