Questions tagged [plugins]

Use it for Drupal 8 plugins; for plugins implemented from the Views module use views, ctools for Chaos tool suite plugins.

Filter by
Sorted by
Tagged with
0
votes
0answers
45 views

Set Custom Form Element Value in Extended LinkWidget Class

I have a class extending LinkWidget and would like to add a new form element. I have omitted all code except what I have added: class CustomWidget extends LinkWidget { public static function ...
0
votes
0answers
8 views

Configure ckeditor per field

I'm wanting to configure ckeditor via a custom plugin (adds a simple drop down of defined terms to insert into text), however, I need to know which field I'm editing so I can load the correct terms ...
0
votes
0answers
25 views

Apply generateOptions() to Custom query() in Views Filter Handler

I am trying to understand how I get the options from generateOptions() to apply to my query() function in a ManyToOne Class. class MyClass extends ManyToOne { public function init(ViewExecutable $...
0
votes
1answer
38 views

Update fields to use a different FieldFormatter during an update hook

I have a drupal.org module that has changed its fieldformatter ID in a later version and I need the update hook to update all isntance of the content to use the new formatter, but cant seem to figure ...
1
vote
0answers
96 views

Drupal\Component\Plugin\Exception\PluginNotFoundException: The “<whatever>” plugin does not exist

After updading a Drupal site from 8.6.16 to 8.7.1 (PostgreSQL 9.6.13 , Nginx) I get this error in almost every operation (creating a view , installing a module, creating a content type, creating a ...
0
votes
0answers
21 views

How do I override a plugin? [duplicate]

I am looking for a way to override a block plugin in Drupal 8. Most of the functionality provided by this block, part of a third-party module, fulfills the requirements. However, a couple of things ...
0
votes
0answers
78 views

Can't place a custom block

After adding a block file to src/Plugin/Block I can't add the block on the Block Layout admin page. When I filter by block name I can see it, but then when I try to place it I can't get to the ...
0
votes
0answers
42 views

How to troubleshoot a `PluginNotFoundException`?

We have a Drupal 8 site. For a while, I've been intermittently getting this entry in the watchdog log: Drupal\imageapi_optimize\Exception\PluginNotFoundException: The "resmushit" plugin does not ...
0
votes
0answers
46 views

Error Passing Function from Form Controller Across Module

I would like to access a function from my Form\Form.php in both my Plugin\Block\Block.php and MYMODULE.module. Related: How to render content generated by controller in custom block? and Inject ...
0
votes
0answers
23 views

PluginNotFoundException after moving the views_bootstrap module

I have a multisite installation with some site having a bootstrap 3.x theme and a new site that should have a bootstrap 4.x theme. All BS3 site are using the views_bootstrap module 8.3.x The new BS4 ...
1
vote
0answers
77 views

Use Drupal's Default Views Filter Handler on “Pseudo” Views field?

How do I use Drupal's core Views filter handler plugins on a custom views field? I have a custom field which has its own FieldPluginBase Class. Does not have a DB query. MYMODULE.views.inc: /** * ...
0
votes
2answers
52 views

Options form with FieldPluginBase?

I tried some variations on the code below, but I have not been able to pass my custom form options to render(). class CustomField extends FieldPluginBase { public function query() { // This is ...
1
vote
1answer
225 views

What was the motivation for developing the plugin API?

I am trying to wrap around my head as to what was the need for the Plugin API when the module system extends the Drupal core.
0
votes
0answers
82 views

Unable to load plugin definitions

I have a custom plugin. As a new user, when I try to load existing plugin definitions, it returns empty. The annotation definition: <?php namespace Drupal\cp_settings\Annotation; use Drupal\...
1
vote
1answer
75 views

Basefield 'string' shown as select list widget in entity form

I've got a custom entity ('content_sharing') and defined one of the fields as $fields['entity_definition'] = BaseFieldDefinition::create('string').... The create-form I'm showing the user is loaded ...
0
votes
1answer
40 views

Unit test a plugin

I want to add a small unit test to a migrate plugin for a migration I am building. I looked for some examples but did not find much for unit tests of a plugin. I want to run some assertions when the ...
0
votes
1answer
38 views

Use 'Search Api Attachments' file extractor in my own custom 'Search Api' processor plugin

I'm writing a custom processor for search api that will search body content of nodes for links to pdfs and extract the content from them to be indexed. It's meant to be able to do the same thing ...
1
vote
0answers
105 views

Custom feeds plugin not discovered [closed]

I am trying to create/work on an Address target plugin for the Feeds module. I have tried applying this Address target patch (shown below) from this related issue. However, the Address field on the ...
1
vote
0answers
66 views

How do i skip a row from a CSV based on the value of 2 fields within the CSV file?

I have a CSV file that contains about 200 records/rows. ID, OrgID, EstabID, OrgName, Address 1, AB234, AB234, ABC corp, 123 Main Street 2, AB234, 8989, ABC Corp-West, 456 Better Street 3, 4858, ...
0
votes
0answers
34 views

CKEditor Filter does not persist text after modifying

I wrote a filter class that strips out certain tags from the user input in the editor. For example it uses a regular expression to remove <span> tags of a certain class. The steps I took were: ...
0
votes
1answer
23 views

How do I reset my search result link?

I created a custom search plugin for a custom entity. I would like to change the link that is presented to the user on the list of results. I had originally set it to the canonical page using $entity->...
1
vote
0answers
63 views

PHP Type Error with Cached Plugin definitions in DiscoveryCachedTrait.php

We have the following set up for Drupal 8.6.3 - IIS Server, MSSQL Server, sqlsrv drivers. However, every few hours, Drupal throws PHP errors(all of them belonging to the same kind) and most pages from ...
0
votes
1answer
35 views

Get Plugin Definition methods using dependency injection

It is my first time defining a custom Plugin Type. I think that this might be a comming thing in Drupal but I was not able to find any documentation anywhere. I want to get Plugin definition methods ...
0
votes
1answer
113 views

migration process plugin not registering

My plugin aims to strip out html tags from titles being imported from xml Here is the error I'm receiving: FVFXF0ETHV2F:process$ drush mim complinet_xml_to_node Drupal\Component\Plugin\Exception\...
1
vote
1answer
445 views

How do I add the ability to change font size in CKEditor?

I'm trying to install the CKEditor Font Size Module in my my editor. I installed the module via composer and then proceeded to copy the font/plugin.js file from the Font Plugin's page into libraries/ ...
1
vote
0answers
55 views

Entity Reference Custom Entity not visible

I made the following module with a custom entity in it. This is all working fine, but now i want to make a entity reference field in some content type to this custom entity. For this i made the ...
0
votes
1answer
48 views

Plugins before event subscribers

Not sure if there's a way out of this problem but... I have a custom log module which listens for events that could come from multiple sources. All it does is listen for an event, and if it occurs ...
0
votes
1answer
20 views

define a template file for a field item in my modules

I wish to register a template file for use with a filed item, but I can't wrap my head around it. here is what I am trying to achieve. In my field widget Formatter public function viewElements(...
0
votes
1answer
86 views

EntityReferenceSelection plugin ignored

I am trying to create a simple time tracking app and for this purpose, I need an entity reference field with some additional filtering of referenced entities (only active projects can be selected). I ...
0
votes
1answer
24 views

Load the value of an entity field type in another form

I have created a custom field and I wish to load the value dynamically in another form in relation to the specific node entity the value belongs to. I understand that to get the value I have to use/...
1
vote
1answer
589 views

How to fix “Cannot read property 'icons' of null” error?

First of all, I'd like to mention this answer is not related, I'm using Drupal 8.6.1. I'm trying to create a CKEditor plugin with a new button. In the /admin/config/content page I get the error but ...
1
vote
0answers
63 views

How to describe data for a custom views filter in the my_module.schema.yml file?

I encountered with a problem. For creating a custom views filter in my own module I should also describe it in the my_module.schema.yml file. Could you clarify me, how to do it? For instance, there ...
1
vote
1answer
122 views

Migration Custom Plugin Return Value

I have a migration and it is very simple. I have a CSV file of employee number and years of service. I have added the two fields to the users in the system and populate them when the users have been ...
0
votes
1answer
209 views

CKEditor oEmbed Plugin Shows up in config but not in actual Editor instance

The issue I'm having is very similar to this question, but the solutions here did not work for me. The steps I took: Downloaded the latest version of the oEmbed plugin from https://ckeditor.com/...
3
votes
0answers
117 views

How to set the correct RSS row plugin?

I need to add an image to the RSS feed. So I create a new row plugin for the RSS and it extends RssFields row plugin. /** * Renders an RSS item based on fields. * * @ViewsRow( * id = "...
1
vote
0answers
27 views

Why methods valueValidate and valueSubmit don't execute?

I'm trying to create a views filter containing an exposed form. The filter class is inherited from FilterPluginBase. In principle, the filter almost works, but I have run into a strange problem. I ...
1
vote
1answer
75 views

The pdf_thumbnail plugin does not exist

After I tried to update the database I got the following error: Failed: Drupal\Component\Plugin\Exception\PluginNotFoundException: [error] The "pdf_thumbnail" plugin does not exist. in ...
0
votes
2answers
172 views

Get the value of one field from another in the same form

I have a form with multiple fields. How can I get the value of field B from within the formElement method of my widget class for field A?
0
votes
1answer
27 views

Lost setting of the custom field when editing a page

I created a content type with my own custom field as described in Why do I get this error when I save my custom field? The insertion of an item with this content type works, but when I want to modify ...
0
votes
1answer
56 views

Why do I get this error when I save my custom field?

I created a custom field and this is its formElement() method. public function formElement(FieldItemListInterface $items, $delta, array $element, array &$form, FormStateInterface $form_state) { ...
0
votes
1answer
21 views

formatting a select custom field

I created a custom field with the following definition: public function formElement(FieldItemListInterface $items, $delta, array $element, array &$form, FormStateInterface $form_state) { $...
0
votes
1answer
87 views

Validation plugin for a Boolean field

I want to contextually filter my View with a boolean field, for which the "On" value is "New," so using a URL like /view/url/new. I first tried basic validation, but that would only work if my URL ...
0
votes
2answers
81 views

How does data propagate from the formElement of a Widget to the properties of a FieldItem?

Here is my custom Widget: <?php namespace Drupal\scripture\Plugin\Field\FieldWidget; use Drupal\Core\Field\FieldItemListInterface; use Drupal\Core\Field\WidgetBase; use Drupal\Core\Form\...
1
vote
1answer
262 views

How can I POST x-www-form-urlencoded data from REST API plugin?

In Drupal 8, the REST API plugin can have a serialization format, such as xml or json. This affects the accepted "request formats" for a resource. Is it possible to add a format for application/x-www-...
1
vote
0answers
27 views

How is a plugin swappable? [duplicate]

Hi I am newbe in Drupal 8 and learning the new plugin system introduced in Drupal 8. I understood the concept of pluggin and also created few plugins like block and field fomatters. But I am not able ...
0
votes
1answer
32 views

How to get a variable from FieldWidget in the same modules Template

I have module that is currently setup like this module -signature.module -signature.info.yml -src -Plugin -Field -FieldWiget -SignatureWidget.php -templates -...
0
votes
0answers
69 views

Custom view relationship handler - access view's contextual filter

I've created a custom relationship handler extending RelationshipPluginBase for a view and want to create a specific SQL JOIN ON condition for this relationship. In the query() part of the plugin I'd ...
0
votes
0answers
52 views

Node field watermark image effect on another node field image

I have installed the drupal 8 image effects module and I've made a copy of the ImageEffect WatermarkImageEffect plugin in my custom module. As with all the image effects you've got the constructor, ...
3
votes
1answer
445 views

Execute actions (actions module not rules module) programatically

How can an action from the actions module be executed programatically? In D7 there was actions_do() but in D8 actions are plugins or configuration entities according to https://www.drupal.org/node/...
1
vote
1answer
394 views

How to use ajax in field widget form?

I need to store a country and a region for geographical objects. Countries and regions are stored in a taxonomy vocabulary. Moreover, some countries have regions (as child terms) but someones don't ...