Problem/Motivation
I added the mapbox field to a ECK bundle. When I attempt to edit it I get the following error:
The website encountered an unexpected error. Please try again later.
Error: Call to undefined function Drupal\mapbox_field\Plugin\Field\FieldWidget\drupal_get_path() in Drupal\mapbox_field\Plugin\Field\FieldWidget\MapboxWidget->formElement() (line 83 of modules/contrib/mapbox_field/src/Plugin/Field/FieldWidget/MapboxWidget.php).
Drupal\Core\Field\WidgetBase->formSingleElement() (Line: 216)
Drupal\Core\Field\WidgetBase->formMultipleElements() (Line: 111)
Drupal\Core\Field\WidgetBase->form() (Line: 287)
Drupal\Core\Field\FieldItemList->defaultValuesForm() (Line: 125)
Drupal\field_ui\Form\FieldConfigEditForm->form() (Line: 106)
Drupal\Core\Entity\EntityForm->buildForm()
call_user_func_array() (Line: 536)
Drupal\Core\Form\FormBuilder->retrieveForm() (Line: 283)
Drupal\Core\Form\FormBuilder->buildForm() (Line: 73)
Drupal\Core\Controller\FormController->getContentResult()
call_user_func_array() (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 580)
Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 121)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext() (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 163)
Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 74)
Symfony\Component\HttpKernel\HttpKernel->handle() (Line: 58)
Drupal\Core\StackMiddleware\Session->handle() (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass() (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle() (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle() (Line: 686)
Drupal\Core\DrupalKernel->handle() (Line: 19)Steps to reproduce
Fresh Drupal 10 install
composer require 'drupal/mapbox_field:^1.0'
drush en mapbox
drush en mapbox_field
Go into Mapbox and configure it with API token and the mapbox style and click save.
* Go to the structure for a Basic Page
* Click on manage fields
* Add a mapbox field
* Set storage settings to 1 and save
* Click on Edit for the map box field.
Proposed resolution
* Update the code so the error doesn't happen.
Remaining tasks
* Find spot where error is happening
* See what needs to be done.
User interface changes
API changes
Data model changes
Issue fork mapbox_field-3366902
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
jaime@gingerrobot.com commentedExample from: drupal_get_path is removed from Drupal 10 must be replaced
https://www.drupal.org/project/entity_translation_unified_form/issues/32...
Comment #3
jaime@gingerrobot.com commentedComment #5
jaime@gingerrobot.com commentedComment #6
jaime@gingerrobot.com commentedOK there is another error now :) I'll go commit the fix for this one.
The website encountered an unexpected error. Please try again later.
Error: Call to undefined function Drupal\mapbox_field\Plugin\Field\FieldFormatter\drupal_get_path() in Drupal\mapbox_field\Plugin\Field\FieldFormatter\MapboxFormatter->viewElements() (line 114 of modules/contrib/mapbox_field/src/Plugin/Field/FieldFormatter/MapboxFormatter.php)
Comment #7
roshni27 commentedThe solution provided above resolved the issue, and it's now ready to move to the "+1 RTBC" .
Comment #9
ahmed.raza commentedThanks Jaime, though the solution needed some polishing which I've done. The new release 1.0.7 contains this fix.
Comment #10
ahmed.raza commented