


Alter views results in a hook
When I use contextual filters in a view, I can select an option to display a summary when the argument is not present. If I do it, it shows a list of node IDs instead of titles. For example, I get the following output, where the first number is the node ID, and the... read more
Content edit links?
I’m new to Drupal 8 and can’t figure out a way to show the edit contextual links for content displayed through the Views module. This was simple in Drupal 7, but in Drupal 8, a view only shows the links for editing; there are no edit or quickedit links for... read more
Implement javascript inside body, error: jQuery is not defined
In Drupal 7, I had js-output template. I define the template output as javascript. This is used for our front end person that can easily input javascript without touching backend. <script> <?php if(isset($content[‘field_custom_javascript’])) print... read more
How do I avoid behaviors are invoked after an AJAX call?
I have a search result page, with the first set of data being fetched during the page load, and we add a Load More button. Clicking on this button fires an AJAX call, using the ajax_links_api module. After the AJAX call is completed, we append more search results to... read more
Subscriptions in Commerce Stripe
I use the Commerce Stripe module to make charges on my website, but I need to be able to subscribe through Stripe, and I have no idea how to do it. The charges I make and without problem but I would need someone to show me the way on how to change the charge to... read more
How can I build a "visitor history" using Flag/Rules?
I need to build a history for visitors so they can see which pages they’ve visited (ideally filtered by type). To do this, it seems that the correct combo is to use Flag module and then Rules. I’d anticipate that I’d create a new rule config where... read more
Searchand Replace text in Drupal Nodes
I client has recently been acquired by a new Group and has requested that I do a search and replace for their name e.g. “Foo Group” and replace this with “New Group”. There will be multiple instances of this e.g. “Foo Housing Trust... read more
How do I filter by birthdays basing on the current date? [closed]
I have a custom content type called profile which has a birthday field (of type Unix timestamp). I need to be able to filter all profiles that have a birthday in the interval (-3 days from now to +7 days from now). How can I achieve this? Do I need to make a custom... read more
How to identify item_selector for Migrate API JSON imports
Trying to import articles from an external JSON feed of “members” with a structure like this: { “status”:”OK”, “results”:[ { “num_results”: 10, “offset”: 0, “articles”: [ {... read more
How to add Open Graph Tags in Custom Module detail page?
For Node I already used https://www.drupal.org/project/metatag For my custom module’s detail page would like to add Open Graph tags for FB share. So in my_test.module function template_preprocess_my_detail_page(&$variables) { $items =... read more
How do I add a basic FlexSlider to the body?
I only need a very simple slider on a single page and so I just want to use Flexslider’s most basic HTML options. But I cannot get it to work! My code is pasted from http://flexslider.woothemes.com/basic-slider-with-custom-direction-nav.html except that... read more
How to set value programmatically for mobile number module’s field using entity wrappers?
how do I set value for the mobile_number field using entity wrappers? Currently, this field is attached to an entity and I’m trying as below. $entity_type = ‘mp_customer’; $entity = entity_create($entity_type, array(‘type’ =>... read more
Search API group by issue with views
I have a content type thats is called course which has a field that is a reference to a taxonomy called category. My specification tells to build a search where users can search for the course title, category and other fields that the course type has. The search... read more
Get the views field value
How to get the views field value and make a condition base on that field. Let say may views field is ‘field_state’ Example below: function my_module_views_pre_render(ViewExecutable $view) { //current user id $user_id = Drupal::currentUser()->id();... read more
How to call preprocess functions from my custom module
I have created a custom module that declares a custom image formatter. Now I need to call the Core image module preprocess function ‘template_preprocess_image_formatter’. How would I do that? I tried to add it in the list of preprocess functions of my... read more
Change URL of site, server and folder remains the same
I want access an old site on a new domain. The server and folder remains the same. I have pointed the new domain to the old Drupal site and updated settings.php to include $base_url = ‘http://www.newurl.com’; I can access the site, but all links in the... read more
Defaut image value not showing up
In my article content type, I’ve added a header image (field_header_image) field which I placed a default image into it so that all articles would have a default image used if one wasn’t needed. However, when creating an article and leaving that field as... read more
Mapping field columns with D8 migrate and d7_node source plugin
I’m trying to write a D8 migrations files but the following one isn’t working on the source ‘body/value’ because it resolves to a null value instead of the intended string. id: my_d7_node_news label: ‘Nodes (News)’ langcode: en... read more