I am trying to create the SkipLink Settings Plugin exactly like explained on
https://drupal-bootstrap.org/api/bootstrap/docs%21plugins%21Setting.md/g...
However, after creating the file /themes/mysubtheme/src/Plugin/Setting/mysubtheme/Accessibility/SkipLink.php, I always end up with this error:
Drupal\Component\Plugin\Exception\PluginException: Plugin (mysubtheme_skip_link_id) instance class "Drupal\mysubtheme\Plugin\Setting\mysubtheme\Accessibility\SkipLink" does not exist. in Drupal\Component\Plugin\Factory\DefaultFactory::getPluginClass() (Line 97 in /var/www/vhosts/mysite.local/httpdocs/core/lib/Drupal/Component/Plugin/Factory/DefaultFactory.php).
This is my SkipLink.php:
<?php
namespace Drupal\mysubtheme\Plugin\Setting\mysubtheme\Accessibility\SkipLink;
use Drupal\bootstrap\Annotation\BootstrapSetting;
use Drupal\bootstrap\Plugin\Setting\SettingBase;
use Drupal\Core\Annotation\Translation;
/**
* The "mysubtheme_skip_link_id" theme setting.
*
* @ingroup plugins_setting
*
* @BootstrapSetting(
* id = "mysubtheme_skip_link_id",
* type = "textfield",
* title = @Translation("Anchor ID for the ""skip link"""),
* defaultValue = "main-content",
* description = @Translation("Specify the HTML ID of the element that the accessible-but-hidden ""skip link"" should link to. (<a href="":link"" target=""_blank"">Read more about skip links</a>.)",
arguments = { ":link" = "http://drupal.org/node/467976" }),
* groups = {
* "mysubtheme" = "MySubTheme",
* "accessibility" = @Translation("Accessibility"),
* },
* )
*/
class SkipLink extends SettingBase {}
I went through all steps from scratch for the third time now.
Any hints what could be wrong?
Comments
Comment #2
markhalliwellThe namespace is wrong.
You don't put the class name at the end, it's what sits underneath the namespace.
It should just be
I'll commit a fix to the docs shortly.
Comment #3
markhalliwellComment #5
markhalliwellComment #6
designcrs CreditAttribution: designcrs commentedWorks perfectly now! Thank you so much!