1

I have been using drupal examples https://www.drupal.org/project/examples and developing my own examples for practice. But I have come against an issue I can't workout. Below is my link to the block code I have been developing.

d8 module block example on github

I can get the block to display under admin/structure/block, but when I press the "Display Block" button in the overlay I get no response can someone tell me why? See image

The error I am getting from the ajax call is

ajax.js?v=8.1.8:965 Uncaught AjaxError: 
An AJAX HTTP error occurred.
HTTP Result Code: 200
Debugging information follows.
Path: /d8/admin/structure/block/add/pnc_block_test/pnc?region=-1
StatusText: OK
ResponseText: 
Fatal error:  Class 'Drupal\Core\block\BlockBase' not found in /vagrant/src/d8/modules/custom/pnc/pnc_block_test/src/Plugin/Block/PncBlockTest.php on line 23

enter image description here

What I have trying to achieve is the following

enter image description here

1 Answer 1

3

Message have say

Fatal error: Class 'Drupal\Core\block\BlockBase' not found in /vagrant/src/d8/modules/custom/pnc/pnc_block_test/src/Plugin/Block/PncBlockTest.php on line 23

problem here is wrong typo block not Block

replace

// Module block exit. But this class not exit
use Drupal\Core\block\BlockBase;

with

//path folder core/lib/Drupal/Core/Block
use Drupal\Core\Block\BlockBase;
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.