Skip to content

Carbon_Fields\Field\Field missing methods (->set_value_type(), ->set_layout(), ->add_fields()) #1189

Description

@npirlot

Version

  • Carbon Fields: 3.6
  • WordPress: latest (but irrelevant for this issue)
  • PHP: 8.1

Expected Behavior

Make all possible methods chained to a Field::make() which yields a Carbon_Fields\Field\Field available in IDE, by applying all possible methods and definitions to themain class.

Actual Behavior

In VSCODE with Intelephense, methods ->set_value_type(), ->set_layout() and ->add_fields() chained to a Field::make( 'image' ... ) or Field::make( 'complex', ...) are not recognised as available methods for Carbon_Fields\Field\Field.

Container definition

Container::make( 'post_meta', __('Home Page') )
->where( 'post_type', '=', 'page' )
->where( 'post_template', '=', 'templates/page-home.php' )
->add_tab(__('Banner'), array(
	Field::make( 'complex', 'banner_elements', 'Banner Elements' )->set_layout('tabbed-horizontal')
	->add_fields(array(
		Field::make( 'image', 'banner_bg_image', 'Banner Background Image' )->set_value_type( 'url' )->set_width(33),
		Field::make('text', 'banner_heading', 'Banner Heading')->set_width(33),
		Field::make('rich_text', 'banner_sub_heading', 'Banner Sub Heading')->set_width(33),
	))
	->set_header_template('
		<% if (banner_heading) { %>
			<%- banner_heading %>
		<% } else { %>
			empty
		<% } %>
	')
))

Steps to Reproduce the Problem

none, this is an IDE issue

Comments

Preview in VSCODE:
image

This issue does not cause failures when running the code, however it would be great that the IDE would not indicate these methods, that are in fact available, as problematic/errors.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions