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
6 votes
1 answer
2k views

How do I replace a plugin?

Let's say that I want to replace the block_content_type plugin of the core block_content module to ad some features while not having to rewrite a whole module to achieve this. It is very easy to ...
2 votes
1 answer
1k 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 ...
6 votes
1 answer
7k views

Twig Template for a Custom Block Plugin

I'd like to have a custom twig template for custom block plugins from my custom module. My custom block HeaderText contains public function build() { return array( '#title' => 'Test', ...
  • 5,442
7 votes
2 answers
8k views

Need to override single Drupal 8 plugin function

What I want to do is edit what is displayed in the autocomplete/drop selects for an entity reference. Basically instead of just [title] I want to show [title] - [other_distinguishing_field]. I know ...
2 votes
2 answers
884 views

Create a custom area plugin

I'm looking to add a plugin for Views to provide some custom functionality in the footer of a view. First, I created the following in my_module/src/Plugin/views/area/MyPlugin.php: namespace Drupal\...
  • 562
8 votes
1 answer
3k views

How set a time type field programmatically?

I create a custom content entity type. I want one field for the event time. Since there is no time field, but a dataTime_type, I create a plugin for a custom field : FieldType : TimeItem.php /** ...
  • 2,498
5 votes
1 answer
777 views

Block Plugin Derivatives Discovery

I need some help with my code. I am creating blocks dynamically using the plugin derivatives. I store some form data in a database table, then I display it in each block separately, depending on it's ...
5 votes
1 answer
6k views

How to create my own custom simple action in D8?

I'm creating a view that is used to review migrated content that was flagged for review during the migration process. I want to provide a bulk action on this view that allows the user to select a ...
  • 1,042
5 votes
2 answers
1k views

Debug plugin discovery

A plugin that I have written is not being discovered. For eg : https://www.drupal.org/node/2847639 Is there a general suggestion for debugging failing plugin discovery?
  • 6,573
2 votes
2 answers
2k views

How to get block instance id in block plugin?

I have block plugin that renders lazy builder placeholder. In my lazy builder I need to get to the block's settings so I wanted to set the block id as lazy builder argument but it turned out the block ...
user avatar
2 votes
0 answers
306 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 ...
  • 21
2 votes
2 answers
2k views

Destination fields not filled from custom migration process plugin

I'm working on a D6 -> D8 migration, and my destination has a custom video upload field (field_video_upload) that contains three pieces of data: video, thumbnail, and poster (field_video_upload_video, ...
  • 1,181
2 votes
1 answer
572 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 ...
1 vote
1 answer
1k 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-...
  • 21.8k
1 vote
2 answers
217 views

Custom plugin modified results in WSOD PluginNotFoundException

I've created a module with a custom Plugin ("group_user"). It all worked great until I modified the code and accidentally introduced an error. This resulted in a WSOD Drupal\Component\Plugin\Exception\...
  • 847
1 vote
2 answers
1k views

How to use migrate process plugin concat on multiple values?

I am trying to import from a csv that has multiple files in the same column, e.g. title,gallery,tag node1,img1.jpg|img2.jpg|img3.jpg,2 node2,img4.jpg,2 node3,img5.jpg|img6.jpg,3 I need to prepend the ...
  • 113
1 vote
2 answers
1k views

How can I access block metadata from custom plugin instance?

Using the block_example module, I created two instances of the example_configurable_text block in the UI and would like to now access their underlying metadata, specifically uuids. By looking at the ...
  • 103
1 vote
1 answer
983 views

Views row style plugin override not saving in Views UI

In my ongoing journey to create a customized RSS feed in my D8 site, I've finally gotten closest to what I need by using a Feed display in Views. The basic feed is working, but I need to add a couple ...
  • 1,181
0 votes
1 answer
871 views

Access data from previously submitted values in buildForm in FormBase plugin

I have a FormBase plugin for an admin configuration page. My desired behavior is to select a series of checkboxes and when you submit the form based on those values a new set of fields will show. ...
  • 5,442
0 votes
2 answers
312 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,877
0 votes
1 answer
280 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
2 answers
1k views

text_format field value not appearing in full_html mode

I'm using a block plugin to display content based on what the user inputs into a form. Select boxes, and radio buttons are saved and displayed in the form just fine but the text_format field isn't ...
  • 5,442