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
1
vote
0answers
31 views

What is The Best Practice for Custom Plugin Files Placement

I'm going to create a custom plugin type, so I need to create a plugin manager, plugin base, plugin Interface and a plugin annotation, the annotations goes to ModuleRoot/src/Annotation but for the ...
0
votes
0answers
77 views

Skip_on_empty row method working, but entity still created

I am migrating a field in a node to a paragraph. I am trying to only create the paragraphs where the field has values. That field is an entity reference to another node. source: plugin: d7_node ...
0
votes
0answers
15 views

How to select the user desired crop in the “Manage Display” section of a paragraph type for an image field?

I'm currently using ImageWidget crop to give some aspect ratios for users to pick when editing content (1:1, 1:2, 2:1, 2:3, 16:9), that is properly set up in the "Manage Form Display" ...
0
votes
1answer
31 views

How do I create a block in a module that can be referenced via an entity reference field?

I'd like to be able to reference my programmed block as a field in a paragraphs. I've Generated a module with drupal console - drupal generate:module Used the template for a block from the example ...
-1
votes
1answer
60 views

Can't get annotated plugin discovery to fire

I've checked Debug plugin discovery and tried restarting Apache and setting $settings['class_loader_auto_detect'] = FALSE; in settings.php, with no change. I have a custom module. Setting a breakpoint ...
1
vote
1answer
36 views

How to remove non breaking space from body/value in migration process?

I am successfully migrating the content from Drupal 7 to Drupal 9. However, I am getting some extra non-breaking spaces I'd like to remove. I tried using a basic str_replace plugin, but that doesn't ...
4
votes
2answers
206 views

How can I let a plugin depend on another module?

Is it possible to let a plugin depend on a module (other than the declaring one)? Use case: I want to create a field widget plugin that should depend on the 'date_all_day' contrib module, but I don't ...
0
votes
0answers
31 views

How to delete taxonomy terms created with entity_generate process plugin?

I have this json. { "ProductKey": "145.1", "Product": { "Title": "Product title", "StartDate": null, ...
0
votes
1answer
45 views

File structure of libraries folder and detection of module external plugins

The module CKeditor anchor link require a CKEditor plugin. Can this plugin be placed in subfolder of the /libraries folder or does it have imperatively to be placed at the root of /libraries ? More ...
0
votes
1answer
21 views

How to create a view filter plugin to filter a column created by a view field plugin

I have created a view field plugin to display an "internal status" for each node in a view. Those status are not stored in a table (and should not) because each status may vary depending the ...
0
votes
0answers
33 views

Error displaying block created progamatically

I am trying to create a block with a form to display inside the block. Here is my block <?php namespace Drupal\fixx_helper\Plugin\Block; use Drupal\Core\Access\AccessResult; use Drupal\Core\Block\...
0
votes
1answer
87 views

why am i getting a Drupal\Component\Plugin\Exception\PluginNotFoundException: when the plugin does exist? [closed]

I wrote a custom source plugin and put it in migd8_node_blog/src/Plugin/migrate/source/Node.php with <?php /** * @file * Contains \Drupal\migd8_node_blog\Plugin\migrate\source\Node. */ ...
0
votes
0answers
23 views

Configurable Action Form Builder Not Called by Views Bulk Operations

I have a configurable Action that I implemented back in VBO 8.x-3.8, and it was working fine. <?php namespace Drupal\my_module\Plugin\Action; use Drupal\Core\Action\ConfigurableActionBase; use ...
0
votes
0answers
64 views

CKEditor Bootstrap 4 plugin for accordion

I want to integrate Bootstrap Accordion to CKEditor in Drupal 8. I created a custom module and linked the bootstrap plugin. When I got to edit the toolbar, the button shows there and I add it to the ...
0
votes
1answer
22 views

How To Set Order State Completed after Notification?

I am Writing a Payment Gateway(Onsite) Plugin For Commerce 2, I am Stuck with Checkout Flow Step Transitions. Let Me Explain: I am extending the OnsitePaymentGatewayBase and in the createPayment() ...
0
votes
0answers
22 views

Mass Contact shouldn't be applying Glossify filter

I'm working on a Drupal 8 site which is both sending out emails with Mass Contact and uses the Glossify plugin filters in a different part of the site. However when sending emails using an "email&...
0
votes
3answers
63 views

Constraint on paragraph field not working

Here is a very simple code: 1-My constraint plugin (MyConstraint.php) /** * @Constraint( * id = "MyConstraint", * label = @Translation("Never Validated", context = "...
1
vote
1answer
24 views

How to get instance of Module / Plugin / Widget of Vote Object in THEME_preprocess_node? [closed]

My drupal site is using the Fivestar Module or from the Vote Up Down Module. Multiple of my content types are using various implementations of these as fields (specifically comments and my primary ...
0
votes
0answers
5 views

Custom view filter integer condition in string format [duplicate]

I have added a new custom view filter with next code: /** * Filter . * * @ingroup views_filter_handlers * * @ViewsFilter("filter_pricelist") */ class PriceListFilter extends ...
1
vote
1answer
222 views

How can I implement paging for a custom query plugin which displays data from an external API?

Hi I have a requirement to display the data from external api but should not be imported into any entities. What I did is I have written a custom view query plugin which displays the data from ...
0
votes
0answers
20 views

Associating form with custom Media source plugin

I need to create a custom Media source plugin to display a CAD drawing from a remote source. In order for me to display the 3-D drawing I need to do three things: Get the part number Load various ...
2
votes
1answer
127 views

custom action plugin with ConfigurationForm

I am trying to create a custom action with Configuration Form Field . I am able to create Action and it is being displayed on content page ( /admin/content ) , but I am not able to find the path to ...
0
votes
0answers
48 views

How to place a plugin block to twig template without any contributed module?

I am using Drupal 8. Have created a custom module, added custom block "LskyTestVideo", created a new page template with its own controller ("LskyOpenTokTestController"). In ...
1
vote
1answer
25 views

Non-Config Menus

I have this requirement where I would need to create a menu every time a user creates a new instance of a custom entity I'm building. One can easily do this with Menu::create() on entity creation, but ...
1
vote
1answer
267 views

Adding Constraint to entity referenced Paragraph field

I'm attempting to follow this documentation to add a custom constraint to a field in a Paragraph but I'm having trouble in adding constraint to that field. Currently I have book content type with ...
0
votes
0answers
50 views

How to be efficient and fast at writing boilerplate code for plugins?

What I am currently doing: Using \Drupal::service for prototyping, for example \Drupal::service('path.matcher')->isFrontPage(); We have phpcs that is checking for this kind of things and it says \...
0
votes
1answer
161 views

Migrating content with referenced taxonomy field is to be migrated by term name

Is it possible to migrate content with term reference fields, but instead of referencing terms by their tid they are referenced by their term name? instead of this: field_tags: plugin: ...
3
votes
1answer
91 views

How can I determine which module is associated with a field plugin?

I'd like to implement an entity hook, and act on all fields defined by Computed Field FieldType plugins. So I either need a list of all FieldType plugins provided by the module or need to know which ...
0
votes
0answers
40 views

Fivestar field can't be migrated

I need help for creating a custom migration. For now, I try to import field into d8, but fivestar fields from d7 don't have "type". Here is the message : drush migrate:messages upgrade_d7_field ----...
0
votes
1answer
49 views

Add custom orderBy in ViewsSort plugin

I'm attempting to sort the results of a View by matching one of the Entity IDs in the result set to the referring URL Entity ID. I'm trying to do this in a custom Views Sort plugin. I did some ...
0
votes
0answers
8 views

Saving the response of an Ajax callback of an element in a custom FieldWidget plugin

I have created a Field widget for Text fields in a content type. If a URL is entered into the text field, an ajax event callback is triggered on change and the URL is parsed to fetch the Open Graph ...
1
vote
0answers
102 views

migration using csv and yml for multivalued image field

some problem with sub-process plugin. Here are my yml and csv files. uuid: c0948690-b539-421e-b306-6a49d14afd64 langcode: en status: true dependencies: { } id: migration_multivalues class: null ...
1
vote
0answers
39 views

How are custom classes auto-discovered and picked up?

I've been trying to get this sub module working for the better part of 8 hours, but I cannot get any debug/log statements to fire inside the sub module. Since its only 3 files, I copy pasted the code ...
0
votes
1answer
66 views

How do plugins store their configuration/field data?

I'm creating a custom Commerce License and I notice that I'm handling defaultConfiguration(), buildConfigurationForm(), submitConfigurationForm(), and buildFieldDefinitions(), but I cannot figure out ...
0
votes
1answer
25 views

Get the values of a checkbox field in node when evaluating in block condition plugin

I have a field that is a checkbox with multiple values... I'm trying to do an evaluation in a condition plugin where I'm checking against the checked values. For a boolean field, the syntax is: $...
0
votes
1answer
214 views

Consume external API from custom block

I am currently writing a custom module - block plugin for Drupal 8 - How do i go about consuming/sending external API data and displaying them using blocks? Is this the standard way - consume/send ...
1
vote
1answer
353 views

Restful permission is required

I've created a @RestResource plugin to provide a REST endpoint to get some data, but when I try a GET from Postman it shows this error: { "message": "The 'restful get ...
0
votes
0answers
41 views

How to test a custom filter on existing view?

I programmatically created a new (custom) filter for the user's view (admin/people). Code for the filter: hook_field_views_data_alter() Plugin > views > filter class The filter works ...
0
votes
1answer
35 views

Check access to existing plugin block

I have a programmatical plugin block defined in theme region. I need to check access to this block in my module hook. The following code creates a new instance, but I need to load an existing plugin ...
1
vote
2answers
190 views

Field formatter module throws cannot declare class error

I am trying to write a custom module, which defines a field formatter plugin, but when I visit the Manage display page, I get this error: Fatal error: Cannot declare class Drupal\my_formatter\...
0
votes
1answer
582 views

Plugin Not Found Exception

I am implementing REST in Drupal 8. I have created a custom plugin for REST resource, enabled the plugin and configured permissions for that REST endpoint. After few days, I removed the code for ...
-1
votes
1answer
54 views

Why would a page created by a custom module work in my DEV environment, but produce a 404 on the live server?

I have a custom module that's creating feeds of my content for me. It's been running fine up until now. Existing feeds work, and the new feed I just added works on my development site on my local mac. ...
0
votes
1answer
40 views

Is there any PHP package that's very similar to the Plugin API? [closed]

I really like the Drupal 8 plugin system. I am now also working on a non-Drupal related project and am wondering if there's any similar solution to that on packagist.org? Was trying to find one but ...
0
votes
0answers
30 views

viewElements Fails To Fire in Custom Field Formatter

Using the code, below, in my_module in the path my_module/src/Plugin/Field/FieldFormatter/DateRangeSpecialFormatter.php the format appears both in the Views field dialog and the content type manage ...
0
votes
0answers
35 views

How to recover datas from a class of service in a custom plugin?

So to be a little clearer, I'm creating a source migrate plugin that extends SourcePluginBase and not SqlBase. I get my data from a class of service, but I would like to know how to bind them to the ...
0
votes
0answers
80 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
1answer
43 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 ...
2
votes
1answer
1k 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
1answer
382 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 ...
1
vote
0answers
130 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: /** * ...