plugin development – show Custom data in homepage

Stack Exchange Network


Stack Exchange network consists of 176 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

views – Custom Slider Programmatically

I am new on drupal and working with drupal-8. currently, I start working on custom module. I want to make a custom slider programmatically for my practice. but I don’t know how should I start. I already have slider HTML and style code…..
anyone can help?? I’ll very thankful.

How to manage custom filters setup

I need to redesign an app in which User can customize the visibility of filters and sources. At the moment, you select sources in one panel and select their corresponding filters in another. Based on User research, I decided to move the sources and filters to the same place. The problem is the business requirement: it should all be visible on one page! So let’s say we have three sources: Books, Films, and Ebooks. Each of the sources has a set of specific filters. But, there are also some general filters. enter image description here

At the moment you select the source via checkbox, then you can set the visibility of filters with toggle switch. Via the cog icon you set the boosting of a given source.

I hate this solution because we’re mixing filters with sources. I prepared a design in which filters and sources are in different pages and you select them independently – the problem is that when you select a source specific filter, you don’t know if this source is on or off (and they cannot change the backend). The design was rejected. I prepared another one with two cards in which the main filters are on one card, the sources are on the other. On the sources card I used progressive disclosure: you select sources you want to search within and then the filters associated with it appear and you can set them then. It was rejected because it was too “stiff” and there was too much clicking.

Do you have any idea what can I do to improve this setting so that Users understand it?

Can i upload duotone custom icons to my kit on font awesome?

I have created a custom duotone icon and I want to upload it to font awesome, Can you do that with the pro plan? is only solid colors permitted? Thank you so much!

get custom file URL wordpress

Let’s say I have a some Files with the name,

  1. $Step-1 => sample_page_1.php
  2. $Step-2 => sample_page_2.php

I can do this:

 <a class="top-progress-bar-stepper"  href="http://132.176.22.165:4337/exm/?step=1">
       <span class="bar-label">Drawings</span>
 </a>
 <a class="top-progress-bar-stepper"  href="http://132.176.22.165:4337/exm/?step=2">
       <span class="bar-label">Upload</span>
 </a>

Any one help me

8 – How to cache a custom rest resource when using Url::fromUri

I have a custom rest resource that is returning data using new ResourceResponse():

$node = Node::load($nid);
$data = load_data('node', $node);
$response = new ResourceResponse($data);
$response->addCacheableDependency($node);
return $response;

This works fine, but if I use the function Url::fromUri into the load_data function I get the error:

LogicException: The controller result claims to be providing relevant cache metadata, but leaked metadata was detected. Please ensure you are not rendering content too early.

I can get it to work if I use ModifiedResourceResponse instead of ResourceResponse, but as far as I understand this will disable all caching. As this resource might end up getting intensive I want to make sure it is cached – how can I do this?

Many thanks in advance!

custom list – Text Column Validation: Numbers only, 5 numbers, a period, and 3 numbers

Try this:

=IF(LEN((YourColumn))=9,IF(MID((YourColumn),6,1)=".",IF(ISNUMBER(VALUE((MID((YourColumn),1,5)))),ISNUMBER(VALUE((MID((YourColumn),7,3)))),FALSE),FALSE),FALSE)

First it validates if it’s a 9 character string or not, then checks if the 6th character is a dot (.), then it validates the first 5 and last 3 characters.

Of course, it might be possible to write in an easier way.

Let me know if this helps.

architecture – Custom system/process failure notifications – code in the domain or as a cross-cutting concern?

We have a number of notification requirements in our new system around service or process failures, e.g.

  • If we fail to pull data from an external partner system regularly this needs to be sent to the service desk to contact the partner and raise the issue
  • If we fail to send an SMS message this needs to go to a business contact so they will call the recipient directly
  • Failure to POST data to a service after several retries – requires notification to service desk so they can analyse the problem and re-trigger the POST again manually if required
  • A business process failure that could occur in any one of multiple services that are responsible for completing that process, needs to be captured and sent as a single notification to service desk so they can start the process again
  • Other failures that require the development team to action

The notifications for these are custom and not just exception messages.

Which is a better design and why?

  1. Capture specific exceptions in the service, generate the custom notification and send the notification in that service, OR
  2. Have a separate (serverless) service that will watch for particular failures from logs or bus events, generate and send the custom notification
  3. Something else

Custom entities in drupal 8

I am an avid user of d7, and am just getting into D8 development for work. The project we are currently working on involves creating about 3 different custom entities (not nodes, users, etc). I am not sure why, but D8 documentation is very sparse compared to d7 documentation, and there doesn’t appear to be a clear answer on how to create a custom entity, attach fields to it, and then create bundles of that entity with additional fields per bundle.

I have tried using drupal consoles generate:entity:content, generate:entity:config and generate:entity:bundle, but none of them seem to do what I am trying to do.

I am trying to specify a new custom entity type, and expose it to the drupal UI so I can define the fields for the base entity, as well as the fields attached to each entity type, similar to how nodes can be accessed using Structure > Content Types > Article/Basic Page.

In d7, you used to be able to use entity construction toolkit, but since that’s not available in d8 anymore, and the documentation doesn’t give a straight answer, I am stuck trying to figure out how to do it on my own.

Does drupal console just not support a way to create a custom entity, attach fields to it, and define bundles of that entity with their own additional fields?

If I have to go into the scaffolding and manually make changes in code to do some of the stuff, that’s fine, but is there a resource somewhere that explains to me how to do that? Because I haven’t been able to find it in the d8 documentation.

nodes – Change max length of title in a custom block added via a template file

A drupal 7 website has a custom block added via a template file. The block displays previews of article content type belonging to a certain rubric. It uses the following line to do so:

$block = module_invoke('views', 'block_view', 'given-block-name'); echo render($block('content'));

The articles displayed have their titles truncated at the length of 50 characters. I could not find the number 50 in the files on the hosting, so it should be somewhere in the database, and so somehow changeable via the admin panel. Yet I am having a very hard time finding where to change this number. I have changed the length of the teaser for the article content, but that apparently bears no influence on what is displayed in the given block.