Carbon-fields: Unknown field type "oembed"

Created on 13 Nov 2020  Â·  10Comments  Â·  Source: htmlburger/carbon-fields

Version

  • Carbon Fields: 3.2.1
  • WordPress: 5.5.3
  • PHP: 7.4

Expected Behavior

To be able to create an oembed field using

Field::make('oembed', 'embed-field', 'Embed Video');
or
Field::make_oembed('embed-field', 'Embed Video');

Actual Behavior

Unknown field type "oembed".

Container definition

Container::make_theme_options('theme-options', 'Theme Options')
->add_fields([
    Field::make_oembed('embed-field', 'Embed Video')
]);

Steps to Reproduce the Problem

  1. Create container that tries to use an oembed

Comments

This looks to be linked to the change made in https://github.com/htmlburger/carbon-fields/pull/915 the field factory can no longer generate the class name

[status] needs more information

Most helpful comment

@jorostoyanov Ping to reopen…

All 10 comments

Hi @martinglover

By using either of the two code samples I had no problems in using the oEmbed field.

Can you clarify whether you are using the plugin or the composer package?

Confirm this issue.
Dirty hack to https://github.com/htmlburger/carbon-fields/blob/development/core/Helper/Helper.php#L426 fix this.

if ($classlike_type === 'Oembed') {
     $classlike_type = 'OEmbed';
}

Hi @jorostoyanov

I'm using the composer install

I'm running Ubuntu 20.04 which is a case sensitive file system whether that affects reproduction of the issue.

The helper normalize_type converts to lower case so is looking for class Oembed while the class is OEmbed

The simplest fix I have at the moment is to rename the OEmbed_Field file and class to Oembed_Field

Also confirming this issue - I didn't see it in my local development environment (non case-sensitive file system) but I had the error on the production server running Linux.

I followed @martinglover's suggestion to rename the file as a temporary fix.

This has been fixed in https://github.com/htmlburger/carbon-fields/pull/915 and is available in the latest release :)

@jorostoyanov : @martinglover is already using the 3.2.1 release (which ships the fix), please reopen.

@jorostoyanov I think you've misunderstood #915 has caused the issue
@zessx is right I'm already using 3.2.1

Installation:

  • Carbon Fields: 3.2.3
  • WordPress: 5.7
  • PHP: 7.4

image

I also have the same problem

  • Carbon Fields: 3.2.3
  • WordPress: 5.7
  • PHP: 7.4
    image

@jorostoyanov Ping to reopen…

Was this page helpful?
0 / 5 - 0 ratings

Related issues

proweb picture proweb  Â·  3Comments

jquimera picture jquimera  Â·  4Comments

leurdo picture leurdo  Â·  3Comments

olegburakov picture olegburakov  Â·  3Comments

Roman52 picture Roman52  Â·  3Comments