carbon-fields icon indicating copy to clipboard operation
carbon-fields copied to clipboard

Post_level condition type doesn't work with integers

Open martisj opened this issue 2 years ago • 0 comments

Version

  • Carbon Fields:3
  • WordPress:6.1.3
  • PHP:8.0.22

Expected Behavior

post_level condition should properly condition🧴 with integer values

Actual Behavior

Fields are displayed regardless of the post_level where condition

Container definition

    Container::make('post_meta', __('Klinikk data'))
        ->where('post_type', '=', 'klinikk')
		->where('post_level', '>=', 2)
        //->where('post_level', 'CUSTOM', function ($post_level) {
		// This works as expected
        //    return $post_level >= 2; 
        //})
        ->add_fields(array(
            Field::make('textarea', 'telefonnummer', __('Telefonnumre'))->set_rows(2),
            Field::make('textarea', 'apningstider', __('Åpningstider')),
            Field::make('textarea', 'epost', __('Epost adresser'))->set_rows(2),
            Field::make('text', 'instagram', __('Instagram')),
            Field::make('text', 'facebook', __('Facebook')),
            Field::make('textarea', 'veibeskrivelse', __('Veibeskrivelse'))->set_rows(3),
            Field::make('image', 'logo', __('Logo')),
            Field::make('map', 'lokasjon', __('Lokasjon')),
        ));

martisj avatar Aug 16 '23 00:08 martisj