Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [plugins]

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

0
votes
0answers
19 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 ...
-2
votes
0answers
45 views

Extending from Plugin Class. How to make this accessible? [on hold]

I want to extend this class (core\modules\menu_link_content\src\Plugin\Menu\MenuLinkContent.php) and add my own method. I did the below class HelpMenuLinkContent extends MenuLinkContent { public ...
0
votes
0answers
45 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
37 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
36 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
17 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 ...
0
votes
0answers
68 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
45 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
224 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
80 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
48 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
33 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
25 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
76 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
45 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
31 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
51 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
32 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
88 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
294 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/ ...
0
votes
0answers
35 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
43 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
59 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
23 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
0answers
396 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 ...
0
votes
0answers
42 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
92 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
193 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
112 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
69 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 ...
1
vote
1answer
239 views

How do I create a custom view filter for an existing field?

I ran into a problem with creating a custom view filter for an existing field for Drupal 8. I mean a filter not for fields like "nid", "title" and so on, but for fields, which were named CCK-fields ...
0
votes
2answers
142 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
51 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
79 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
64 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
216 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
26 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
30 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
55 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
397 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
308 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 ...
0
votes
1answer
55 views

Custom field - Object could be converted to string

I have a very simple custom field/widget/formatter set. YoutubeLink.php (custom field): <?php namespace Drupal\ad_general\Plugin\FIeld\FieldType; use Drupal\Core\Field\FieldItemBase; use Drupal\...
0
votes
0answers
15 views

Admin path broken after localisation removal

I tried to fiddle with some localisation using modules content_translation, config_translation, locale and language. The problem is, after uninstall of all of the above, the frontend links for block ...
0
votes
1answer
50 views

Extending an existing Plugin class results in Class not Found PHP Fatal Error

I am trying to create my own Plugin that extends an existing Plugin class. I can extend the base class and everything is fine. However, if I extend a existing Plugin class, I get a Class not Found ...