The field is not displayed but is still required

Created on 27 October 2017, over 7 years ago
Updated 9 January 2025, 5 months ago

I created an image field called "Logo". I do not want this field to be created or edited by users with the "Particulier".

When I create a shop the following error message is displayed "The Logo field is required." Yet the field is not displayed.

Here is my diary :

Warning: array_key_exists() expects parameter 2 to be array, null given in Drupal\image\Plugin\Field\FieldWidget\ImageWidget::validateRequiredFields() (line 266 of /home/www.s1biose.com/public_html/web/core/modules/image/src/Plugin/Field/FieldWidget/ImageWidget.php) #0 /home/www.s1biose.com/public_html/web/core/includes/bootstrap.inc(566): _drupal_error_handler_real(2, 'array_key_exist...', '/home/www.s1bio...', 266, Array) #1 [internal function]: _drupal_error_handler(2, 'array_key_exist...', '/home/www.s1bio...', 266, Array) #2 /home/www.s1biose.com/public_html/web/core/modules/image/src/Plugin/Field/FieldWidget/ImageWidget.php(266): array_key_exists('alt', NULL) #3 [internal function]: Drupal\image\Plugin\Field\FieldWidget\ImageWidget::validateRequiredFields(Array, Object(Drupal\Core\Form\FormState), Array) #4 /home/www.s1biose.com/public_html/web/core/lib/Drupal/Core/Form/FormValidator.php(281): call_user_func_array(Array, Array) #5 /home/www.s1biose.com/public_html/web/core/lib/Drupal/Core/Form/FormValidator.php(239): Drupal\Core\Form\FormValidator->doValidateForm(Array, Object(Drupal\Core\Form\FormState)) #6 /home/www.s1biose.com/public_html/web/core/lib/Drupal/Core/Form/FormValidator.php(239): Drupal\Core\Form\FormValidator->doValidateForm(Array, Object(Drupal\Core\Form\FormState)) #7 /home/www.s1biose.com/public_html/web/core/lib/Drupal/Core/Form/FormValidator.php(239): Drupal\Core\Form\FormValidator->doValidateForm(Array, Object(Drupal\Core\Form\FormState)) #8 /home/www.s1biose.com/public_html/web/core/lib/Drupal/Core/Form/FormValidator.php(239): Drupal\Core\Form\FormValidator->doValidateForm(Array, Object(Drupal\Core\Form\FormState)) #9 /home/www.s1biose.com/public_html/web/core/lib/Drupal/Core/Form/FormValidator.php(119): Drupal\Core\Form\FormValidator->doValidateForm(Array, Object(Drupal\Core\Form\FormState), 'commerce_store_...') #10 /home/www.s1biose.com/public_html/web/core/lib/Drupal/Core/Form/FormBuilder.php(571): Drupal\Core\Form\FormValidator->validateForm('commerce_store_...', Array, Object(Drupal\Core\Form\FormState)) #11 /home/www.s1biose.com/public_html/web/core/lib/Drupal/Core/Form/FormBuilder.php(314): Drupal\Core\Form\FormBuilder->processForm('commerce_store_...', Array, Object(Drupal\Core\Form\FormState)) #12 /home/www.s1biose.com/public_html/web/core/lib/Drupal/Core/Controller/FormController.php(74): Drupal\Core\Form\FormBuilder->buildForm('commerce_store_...', Object(Drupal\Core\Form\FormState)) #13 [internal function]: Drupal\Core\Controller\FormController->getContentResult(Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Routing\RouteMatch)) #14 /home/www.s1biose.com/public_html/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array) #15 /home/www.s1biose.com/public_html/web/core/lib/Drupal/Core/Render/Renderer.php(576): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() #16 /home/www.s1biose.com/public_html/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure)) #17 /home/www.s1biose.com/public_html/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) #18 [internal function]: Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() #19 /home/www.s1biose.com/public_html/vendor/symfony/http-kernel/HttpKernel.php(153): call_user_func_array(Object(Closure), Array) #20 /home/www.s1biose.com/public_html/vendor/symfony/http-kernel/HttpKernel.php(68): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1) #21 /home/www.s1biose.com/public_html/web/core/lib/Drupal/Core/StackMiddleware/Session.php(57): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #22 /home/www.s1biose.com/public_html/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(47): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #23 /home/www.s1biose.com/public_html/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(99): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #24 /home/www.s1biose.com/public_html/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(78): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true) #25 /home/www.s1biose.com/public_html/web/core/modules/ban/src/BanMiddleware.php(50): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #26 /home/www.s1biose.com/public_html/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(47): Drupal\ban\BanMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #27 /home/www.s1biose.com/public_html/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(50): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #28 /home/www.s1biose.com/public_html/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #29 /home/www.s1biose.com/public_html/web/core/lib/Drupal/Core/DrupalKernel.php(657): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #30 /home/www.s1biose.com/public_html/web/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request)) #31 {main}.

πŸ› Bug report
Status

Needs work

Component

User interface

Created by

πŸ‡«πŸ‡·France zenimagine

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΊπŸ‡ΈUnited States redbrickone

    Hi is there any update here? Looking for a patch that would work with Drupal 10.4.1. I am keeping field permissions set to 8.x-1.3 in order to keep this patch that works with this version. When updated to 8.x-1.4 the patch no longer works.

    This is the patch I am using: https://www.drupal.org/files/issues/2919343-3-thefieldisnotdisplayedbuti... β†’
    This works fine with 8.x-1.3 but unable to update to 8.x-1.4 and still use this patch or the latest patch added to this issue.

    Thanks!

  • πŸ‡ΊπŸ‡ΈUnited States redbrickone

    I re-rolled the last patch to work with 8.x-1.4. Seems to apply fine now. I was having issues with it on the latest version of field_permissions with Drupal 10.4.1.
    If anyone wants to test this out or add to an MR for this issue that would be great!

Production build 0.71.5 2024