Drupal Dev Thursdays: Post here with development questions or discussion

Drupal - Open Source Content Platform - Thu, 11/29/2018 - 09:06

This is the weekly thread for development questions or chit-chat that doesn't belong in the Monday Beginner Questions thread. All questions/comments/ranting about Drupal dev is fair game.

(Check out the weekly post schedule in the sidebar)

submitted by /u/AutoModerator
[link] [comments]

PhantomJS and creating a screenshot from website

Drupal - Open Source Content Platform - Thu, 11/29/2018 - 07:51

I am looking for some friendly guidance please, I am pretty much a Drupal front-end veteran and site builder, however my back-end module development skills are beginner level, but this project would be a great way for me to advance these skills!

The end result is the following - Allow the user to input into a field multiple URLs to websites which will then have a screenshot taken in 2 resolutions, stored as managed files which are associated with that instance of the field (so that if the URL is removed those screenshots will also be removed). And then to place the screenshots into a template image of a laptop and mobile phone - the end result something like this https://makeitminefinance.s3.ap-southeast-2.amazonaws.com/a5dc7e7315a824d34585b07bb1af29ff%7C650%7C650%7Clandscape

I have found this module https://www.drupal.org/project/phantomjs_capture which has a working copy for D8, tested and working fine, it successfully takes a screenshot when provided a URL

My thinking is I need to first create a field type which can utilise this module, or maybe just create a widget for the link field type?

Any suggestions at this stage would be very welcome. Thanks

submitted by /u/dbj2000
[link] [comments]

Remove author but not date from article

Drupal - Open Source Content Platform - Wed, 11/28/2018 - 11:15

Is it possible to remove the author info but keeping the date info on a post such as an article? I don't have access to any code or folders, I can install modules if needed.

I want to keep what's in the green box but hide what inside the red one. https://gyazo.com/e4e541e9592fd80259da2405b8801375

...so that it looks something like this: https://gyazo.com/13de6db2ffa11eeab4f13b076a4b9e54

submitted by /u/foodcontainer
[link] [comments]

It's Drupal Contrib Wednesday! Post recent contrib module likes/dislikes

Drupal - Open Source Content Platform - Wed, 11/28/2018 - 09:07

Have you tried a new module or theme recently, or do you have a favorite that nobody seems to know about? Tell us what you like or dislike.

(Check out the weekly post schedule in the sidebar)

submitted by /u/AutoModerator
[link] [comments]

Drupal functions .php

Drupal - Open Source Content Platform - Wed, 11/28/2018 - 06:34

HI, I installed drupal 7 with xampp, what files / folders do I have to modify to add or edit the .php functions?

I need to write some functions like hook_node_view and hook_presave.


submitted by /u/LoudChildhood
[link] [comments]

How to edit pages in Drupal website?

Drupal - Open Source Content Platform - Wed, 11/28/2018 - 01:21

Hi so I want to know the exact nodes address of pages my developer created.

Let's say there's the homepage itself, or a 404 page. If the 404 page address is example.com/page-not-found then how do I edit this page (html code) if I'd like to myself?

I've a Drupal 7 website. Thanks!

submitted by /u/froddo7
[link] [comments]

Speedier Web Server Platform for D7 - OVH or Amazon Lightsail?

Drupal - Open Source Content Platform - Tue, 11/27/2018 - 16:30

Hi everyone,

I'm setting up a web server migration project for the company I work for, which has an older D7 site on an under-powered Debian Rackspace virtualized web server. The current Rackspace instance only has 2GB RAM and struggles to keep up with a site that receives 1K-4K visitors daily. This D7 site is also a bit module heavy and has an old inefficient D7 theme, which are separate subjects for future optimization.

In the interests of pure load time from the user's perspective as measured by TTFB/response time, Google Page Speed Insight scores, Google Lighthouse speed test, and WebPageTest.org, what would be the best choice to jump to? This would be keeping the exact same setup in terms of Drupal, but upgrading the web server infrastructure under the hood.

So far we're leaning towards a dedicated server with OVH or Amazon Lightsail (which is just a type of EC2 as broken down here). Google Cloud Engine and Vultr have been talked about too. Anyone here have experience load times across these? It's really hard to find speed benchmarks that span all of them, especially ones for Drupal. I've thought of setting up test sites on both and benchmarking them myself for our specific site. So I would love to hear some input on OVH vs Lightsail in particular from those who might have already tried ...

P.S. We're not ready yet to go over to Pantheon or Acquia or something of the sort.

submitted by /u/dubesor
[link] [comments]

Basic question (?) about displaying field content in a D8 view

Drupal - Open Source Content Platform - Tue, 11/27/2018 - 15:23

I think this is a very basic question -- thanks in advance for any help!

I want to show a custom background image in the header of all the Basic Page nodes on my D8 site. I got it working for one page by creating a block using Views -- the block contains the image and also the page title.


My hope is that there's a very simple Views setting that will automatically display the image field from the Basic Page that's currently being viewed. For example, when I view the Resources page (NID 2), the title and image would come from that node, and when I display another Basic Page (NID 3), the block would display the title and image from that node.

Here's what the view currently looks like:


I assume all I need is some kind of filter on the view, but I'm not sure how to do it. Thanks for reading!

submitted by /u/heartsutra
[link] [comments]

Module: Icon Tabs

Drupal - Open Source Content Platform - Tue, 11/27/2018 - 09:59

Hello everyone

For a school assignment i need to port a drupal 7 module to drupal 8. I've chosen to update the module Icon Tabs.

Does someone have experience with porting? I've watched a couple of tutorials of how to create/port a module. Are there any specific struggles that i need to know before i start porting? I do have experience programming in PHP.

Will the module be used if I port him to Drupal 8?

Thanks in advance!

submitted by /u/jorikspiess
[link] [comments]

It's Triumphant Tuesday! Post your recent Drupal wins and launches

Drupal - Open Source Content Platform - Tue, 11/27/2018 - 09:06

Here's your chance to brag about cool stuff you've done recently and awesome sites you've shipped. Anything happy and Drupal-related goes.

(Check out the weekly post schedule in the sidebar)

submitted by /u/AutoModerator
[link] [comments]

Apply different ALT and TITLE when RE-using an image?

Drupal - Open Source Content Platform - Tue, 11/27/2018 - 06:52

Is there any standarized way to use the Media Library and set custom ALT and TITLE tags on the image; each time I use the image I want to set different tags to better match the content next to it.

submitted by /u/petergus
[link] [comments]

How to create group specific pages for users?

Drupal - Open Source Content Platform - Mon, 11/26/2018 - 20:39

Hi Reddit,

I am trying to create a drupal site where each group would have their “page” which is populated by content their group has access to.

So a user is part of group 1,

Group 1 is part of group A and group B

When the admin assigns content to either group 1, A or B, user 1 has access to it on their “page”

What would be the best way to accomplish this?

Drupal 8, newbie, coming from strong Wordpress background.

Thanks for all the help!

submitted by /u/Yorkmiester
[link] [comments]

DrupalCon Seattle Selections

Drupal - Open Source Content Platform - Mon, 11/26/2018 - 13:34

As many folks know, the selections for DrupalCon have gone out. As a member of the selections team, I've already heard some grumbling - please remember that we have hundreds and hundreds of sessions to review and we don't give feedback to sessions we decline. However, you are more than welcome to reply to the email you received from Amanda and ask for feedback, or to reach out to folks in the tag(s) you submitted to [https://events.drupal.org/seattle2019/team]. We can't change anything for this year but we can give you an idea of what to do for next time.

And just because your session wasn't selected doesn't mean it wasn't good! There might have been 5 very similar equally good sessions on the same topic, etc, so please don't be discouraged! That's the main reason I'm posting this. We are happy to be as transparent as possible, but you'll have to reach out and ask.

submitted by /u/aburke626
[link] [comments]

Change timestamp text on article

Drupal - Open Source Content Platform - Mon, 11/26/2018 - 10:33

I have a page where we post articles, on top of every article there is a time stamp. The problem is that the weekday is shorted so it will say wed instead of Wednesday for example. This text is inside the header tag inside the article tag.

Is it possible to change this on every existing article and future articles without access to the real code? I can't access any folders or code but i am able to install models if needed.

Edit: I use Drupal 7!

submitted by /u/foodcontainer
[link] [comments]

Weekly Drupal beginner questions thread

Drupal - Open Source Content Platform - Mon, 11/26/2018 - 09:06

Ask your newbie questions here! No judgement!

(Check out the weekly post schedule in the sidebar)

submitted by /u/AutoModerator
[link] [comments]

Problem using language adding, strange error, was unable to post on their support page

Drupal - Open Source Content Platform - Mon, 11/26/2018 - 04:14

So I came eventually here to ask, since Drupal's support page somehow put a lockdown on a simple post.

So I post it here, in the hope someone could help me figure out what is going on, since some other people seem to have the same issue.

First this one, I get a strange error in the module listing, and it feels like this in the core.I'm pretty sure this error resides in perhaps a custom module of mine, but I have no way to figure out what is causing this, other then these error messages, it doesn't tell me much more.

Notice: Array to string conversion in Drupal\Core\Routing\RouteProvider->preLoadRoutes() (line 215 of core/lib/Drupal/Core/Routing/RouteProvider.php). Drupal\Core\Routing\RouteProvider->preLoadRoutes(Array) (Line: 242) Drupal\Core\Routing\RouteProvider->getRoutesByNames(Array) (Line: 199) Drupal\Core\Routing\RouteProvider->getRouteByName(Array, Array) (Line: 83) Drupal\Core\Access\AccessManager->checkNamedRoute(Array, Array, Object) (Line: 247) Drupal\system\Form\ModulesListForm->buildRow(Array, Object, 'Drupal') (Line: 161) Drupal\system\Form\ModulesListForm->buildForm(Array, Object) call_user_func_array(Array, Array) (Line: 518) Drupal\Core\Form\FormBuilder->retrieveForm('system_modules', Object) (Line: 275) Drupal\Core\Form\FormBuilder->buildForm('system_modules', Object) (Line: 93) Drupal\Core\Controller\FormController->getContentResult(Object, Object) call_user_func_array(Array, Array) (Line: 123) Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 582) Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124) Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97) Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 151) Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 68) Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57) Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47) Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 99) Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 78) Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47) Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 52) Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23) Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 669) Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

Drupal: 8.6.3 - Apache: 2.4.25 - PHP: 7.2.9

The original issue I have is with adding a language:

The website encountered an unexpected error. Please try again later. *Error*: Call to a member function setWeight() on null in *Drupal\\language\\ConfigurableLanguageManager->updateLockedLanguageWeights()* (line *357* of *core/modules/language/src/ConfigurableLanguageManager.php*).Drupal\\language\\ConfigurableLanguageManager->updateLockedLanguageWeights() (Line: 133) Drupal\\language\\Entity\\ConfigurableLanguage->postSave(Object, ) (Line: 506) Drupal\\Core\\Entity\\EntityStorageBase->doPostSave(Object, ) (Line: 432) Drupal\\Core\\Entity\\EntityStorageBase->save(Object) (Line: 263) Drupal\\Core\\Config\\Entity\\ConfigEntityStorage->save(Object) (Line: 390) Drupal\\Core\\Entity\\Entity->save() (Line: 632) Drupal\\Core\\Config\\Entity\\ConfigEntityBase->save() (Line: 296) Drupal\\Core\\Entity\\EntityForm->save(Array, Object) (Line: 87) Drupal\\language\\Form\\LanguageAddForm->save(Array, Object) call\_user\_func\_array(Array, Array) (Line: 111) Drupal\\Core\\Form\\FormSubmitter->executeSubmitHandlers(Array, Object) (Line: 51) Drupal\\Core\\Form\\FormSubmitter->doSubmitForm(Array, Object) (Line: 589) Drupal\\Core\\Form\\FormBuilder->processForm('language\_admin\_add\_form', Array, Object) (Line: 318) Drupal\\Core\\Form\\FormBuilder->buildForm('language\_admin\_add\_form', Object) (Line: 93) Drupal\\Core\\Controller\\FormController->getContentResult(Object, Object) call\_user\_func\_array(Array, Array) (Line: 123) Drupal\\Core\\EventSubscriber\\EarlyRenderingControllerWrapperSubscriber->Drupal\\Core\\EventSubscriber\\{closure}() (Line: 582) Drupal\\Core\\Render\\Renderer->executeInRenderContext(Object, Object) (Line: 124) Drupal\\Core\\EventSubscriber\\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97) Drupal\\Core\\EventSubscriber\\EarlyRenderingControllerWrapperSubscriber->Drupal\\Core\\EventSubscriber\\{closure}() (Line: 151) Symfony\\Component\\HttpKernel\\HttpKernel->handleRaw(Object, 1) (Line: 68) Symfony\\Component\\HttpKernel\\HttpKernel->handle(Object, 1, 1) (Line: 57) Drupal\\Core\\StackMiddleware\\Session->handle(Object, 1, 1) (Line: 47) Drupal\\Core\\StackMiddleware\\KernelPreHandle->handle(Object, 1, 1) (Line: 99) Drupal\\page\_cache\\StackMiddleware\\PageCache->pass(Object, 1, 1) (Line: 78) Drupal\\page\_cache\\StackMiddleware\\PageCache->handle(Object, 1, 1) (Line: 47) Drupal\\Core\\StackMiddleware\\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 52) Drupal\\Core\\StackMiddleware\\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23) Stack\\StackedHttpKernel->handle(Object, 1, 1) (Line: 669) Drupal\\Core\\DrupalKernel->handle(Object) (Line: 19)

submitted by /u/Power2All
[link] [comments]