Drupal

Twig Views

drupal.org - Modules - Wed, 11/07/2018 - 17:55

Twig Views adds a Twig extension to render views in Twig with title by passing in the view machine name and display name.

To render a view, call the function in your Twig template:

{{ render_view('view_machine_name', 'display_machine_name')}}
Categories: Drupal

Ashday's Digital Ecosystem and Development Tips: Custom Cache Tags and Max-age: Advanced Cache Handling in Drupal 8

drupal.org aggregator - Wed, 11/07/2018 - 15:02

Determining how content on your site should be cached isn't a simple topic. Last time, I covered cache contexts and tags. Today, I'd like to get into a couple more advanced topics: The use of custom cache tags and of max-age.

Categories: Drupal

Need help implementing hooks

Drupal - Open Source Content Platform - Wed, 11/07/2018 - 12:43

So I use hook alter(). But how do I find out the module I want to alters code to plug into the parentheses

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

Making the user picture automatically display in blog posts

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

I am working on a school website, the customer wanted a blog feature that each user with blog permission can create a blog entry that will appear on a master "blog" page. My question is, how can I automatically use their user picture to display next to their blog entry everything they post something?

I feel like it is simple but I am drawing a blank. I made a page similar with news articles but I am using Organic Groups that are associated to the schools they choose. I COULD do it that way, but I would rather have their user avatar appear automatically. Any thoughts?

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

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

Drupal - Open Source Content Platform - Wed, 11/07/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]

TEN7 Blog's Drupal Posts: Episode 044: DrupalCamp Ottawa 2018

drupal.org aggregator - Wed, 11/07/2018 - 09:06
It is our pleasure to welcome once again Tess Flynn, TEN7's DevOps Engineer and DrupalCamp ambassador, to discuss the 2018 DrupalCamp Ottawa. Here's what we're discussing in this podcast: 2018 DrupalCamp Ottawa; Minnesota maple syrup; Camp format; Ottawa's move to Drupal open source; Award for travelling the farthest to attend; Camp without BOFs; Drupal 101; Keynote: “Building Accessible Experiences”; Accessibility is a core aspect of the entire design experience; Socketwench presents: "Healthcheck your site!"; Building software as a service Privacy laws differences between Canada and the US
Categories: Drupal

OSTraining: How to Create Drupal Charts With Views

drupal.org aggregator - Wed, 11/07/2018 - 09:06
There are many ways to present data to your readers. One example would be a table or a list. Sometimes the best approach is to show data on a chart.

It can ease understanding of large quantities of data. There is a way to make charts in Drupal with the help of the Charts module and Views.

In this tutorial, you will learn the basic usage of the module in combination with the Google Charts library. Let’s start!

Categories: Drupal

InternetDevels: The scheduled release of Drupal 9: what it means for Drupal 8 and 7

drupal.org aggregator - Wed, 11/07/2018 - 09:03

Every big Drupal release opens fantastic opportunities for websites. Three years ago, the eighth Drupal version came to this world — and the world fell in love with top-notch Drupal 8 improvements.

Read more
Categories: Drupal

iRolo.net: Installing Lando on Windows

drupal.org aggregator - Wed, 11/07/2018 - 08:54

Installing Lando on a Windows machine is easy. Just follow these 30 (or more) simple steps:

  1. Review the directions.
  2. Figure out which version of Windows you are running.
  3. Realize that you need to upgrade to Windows 10 Professional, because apparently you have to pay extra to actually do work on a Windows machine.
  4. Open the Windows Store.
  5. Spend half an hour trying to figure out why the Windows store is only showing blank pages.
  6. Take a break, go vote, spend some time with your kids, and seriously consider buying a Mac so that you don't have to deal with this shit.
  7. Reboot your computer and finally get Windows store to respond.
  8. Pay $100 dollars, while updating your account information because everything is three years out-of-date. Do not pass Go.
  9. Reboot your computer twice.
  10. Go to the Lando releases page.
  11. Spend some time looking for the last stable release (note: there is no spoon stable release).
  12. Download and run the latest .exe.
  13. The installer will complain that you don't have Hyper V, which you just paid for.
  14. Find the obscure command you need to enable Hyper V.
  15. Find Powershell in the Start menu.
  16. Discover that you can paste into PowerShell just by right-clicking your mouse. This seems convenient, but it's a trap!
  17. Run the command. It doesn't work.
  18. Learn how to run PowerShell as an administrator.
  19. Run the command, again.
  20. Reboot your computer, again.
  21. Run the .exe, again.
  22. The installer wants to install Docker. Let it.
  23. The Docker installer wants you to log you out. Let it
  24. Log back in.
  25. Open Babun and try the lando command. It isn't found.
  26. Open Powershell and try the lando command. It isn't found.
  27. Open the Command Prompt and try the lando command. It isn't found.
  28. Re-run the Lando installer, for the third time. It turns out that it never finished because Docker logged you out.
  29. Open Powershell and try the lando command.
  30. It works! Congratulations, you are done!*

* Just kidding...

  1. Open PowerShell. Go to the directory where you have your Drupal site.
  2. Run lando init.
  3. Choose the drupal 7 recipe.
  4. Why is it asking for a Pantheon machine token? This isn't a Pantheon site! Hit Ctrl-C.
  5. Log into Pantheon, create a machine token for your Windows machine. note: Terminus and Lando are notorious for asking for this machine token over and over, so make sure to paste this machine token into a file somewhere, which kind of defeats the entire point of having a machine token.
  6. Run lando init, again.
  7. Right clicking to paste doesn't work for the hidden machine token. So, learn a different way to paste the machine token into PowerShell.
  8. Congratulations, you are done!**

** Just kidding...

  1. Run lando start. Your terminal will proceed to spew error messages for several minutes.
  2. Spend an hour searching through the Lando issue queue trying to find the magic sequence that will fix these errors.
  3. Go apple.com and start comparing the new MacBook Air to the new Mac Mini. Figure out if you can afford either one so that you don't have to deal with this shit.
  4. Your kids are picking up on your frustration, and everyone is melting down because it is bedtime (and your are anxious about the election).
  5. Give up for the night, and obsessively refresh the election results at fivethirtyeight.com until the results are clear at 11:00 PM.
  6. Get up the next morning and write a satirical article about installing Lando on your Windows machine.

I will let you know if I ever actually get it working.

Tags:
Categories: Drupal

Appnovation Technologies: 5 Tips to Attend a Conference Like a Pro

drupal.org aggregator - Wed, 11/07/2018 - 08:24
5 Tips to Attend a Conference Like a Pro This week we're wheels up for Acquia Engage, where the foremost leaders in digital will take center stage to share their insights, revelations, and lessons learned in the quest to deliver best-in-class customer experiences. We're excited to be sponsoring the event again this year and can't wait to learn, share, meet and discuss with our peer...
Categories: Drupal

Googalytics Commerce

drupal.org - Modules - Wed, 11/07/2018 - 07:51

Provides integration of Drupal Commerce into Googalytics module by implementing the Google Analytics Ecommerce Tracking commands on placing an order.

At least currently, only the Ecommerce Tracking is supported, not the Enhanced one. This is ideal, if you only want to track placed orders (totals, as well as individual order items).

Categories: Drupal

Animated scroll to

drupal.org - Modules - Wed, 11/07/2018 - 05:28

This module creates an animated scroll to elements.

Single and multiple hashes in the URL are allowed. This are some correct URLs:

  • example.com#scrollToMe
  • example.com#scrollToMe#AndToMe
  • example.com#scrollToMe#AndToMe#AlsoToMe

The scroll speed, pause, correction and easing can be set per element (see below).

Default settings can be set on /admin/config/animate-scroll-to/settings

The settings can be overridden per element with the following attributes:

Categories: Drupal

Dropsolid: Dropsolid at Drupal Europe

drupal.org aggregator - Wed, 11/07/2018 - 04:40
07 Nov Drupal Europe dropsolid8 Drupalcon Drupal conferenties general Drupal Drupal

Last September Dropsolid sponsored and attended Drupal Europe. Compared to the Northern America’s conferences, getting Europeans to move to another location is challenging. Certainly when there are many conferences of such high quality that compete such as Drupalcamps, Drupal Dev Days, Frontend United, Drupalaton, Drupaljam, Drupal Business Days. I’m happy for the team they succeeded in making Drupal Europe profitable, this is a huge accomplishment and it also sends a strong signal to the market!

Knowing these tendencies, it was amazing to see that there is a huge market-fit for the conference that Drupal Europe filled in. Also a great sign for Drupal as a base technology and the growth of Drupal. Hence, for Dropsolid it was a must to attend, help and to sponsor such an event. Not only because it helps us getting the visibility in the developer community but also to connect with the latest technologies surrounding the Drupal ecosystem.

The shift to decoupled projects is a noticeable one for Dropsolid and even the Dropsolid platform is a Drupal decoupled project using Angular as our frontend. Next to that, we had a demo at our booth that showed a web VR environment in our Oculus Rift where cotent came from a Drupal 8 application.

 

 

On top of that, Drupal Europe was so important to us that our CTO helped the content team by being a volunteer and selection the sessions that were related to Devops & Infrastructure. Nick has been closely involved in this area and we’re glad to donate his time to help curate and select qualitative sessions for Drupal Europe.

None of this would have been possible without the support of our own Government who supports companies like Dropsolid to be present at these international conferences. Even though Drupal Europe is a new concept, it was seen and accepted as a niche conference that allows companies like Dropsolid to get brand awareness and knowledge outside of Belgium. We thank them for this support!

 

 

From Nick: “One of the most interesting sessions for me was the keynote about the “Future of the open web and open source”. The panel included, next to Dries, Barb Palser from Google, DB Hurley from Mautic and Heather Burns. From what we gathered Matt Mullenberg was also supposed to be there but he wasn’t present. Too bad, as I was hoping to see such a collaboration and discussion. The discussion that got me the most is the “creepifying” of our personal data and how this could be reversed. How can one gain control the access of your own data and how can one revoke such an access. Just imagine, how many companies have your personal name and email and how could technology disrupt such a world where an individual controls what is theirs. I recommend watching the keynote in any case!”

 

*/ /*-->*/ /*-->*/ /*-->*/

 

We’ve also seen how Drupal.org could look like with the announced integration with Gitlab. I can’t recall myself being more excited when it comes to personal maintenance pain. In-line editing of code being one of the most amazing ones. More explanation can be found at https://dri.es/state-of-drupal-presentation-september-2018.

 

*/ /*-->*/ /*-->*/ /*-->*/

 

From Nick: 
“Another session that really caught our eye and is worthy of a completely separate blogpost is the session of Markus Kalkbrenner about Advanced Solr. Perhaps to give you some context, I’ve been working with Solr for more than 9 years. I can prove it with a commit even!  https://cgit.drupalcode.org/apachesolr_ubercart/commit/?id=b950e78. This session was mind blowing. Markus used very advanced concepts from which I hardly knew the existence of, let alone found an application for it. 

One of the use cases is a per-user sort based on the favorites of a user. The example Markus used was a recipe site where you can rate recipes. Obviously you could sort on the average rating but what if you want to sort the recipe’s by “your” rating. This might seem trivial but is a very hard problem to solve as you have to normalize a dataset in Solr which is by default a denormalized dataset. 

Now, what if you want to use this data to get personalized recommendations. This means we have to learn about the user and use this data on the fly to get these recommendations based on the votes the user applied to recipes. Watch how this work in the recording of Markus and be prepared to have your mind blown.”

 

*/ /*-->*/ /*-->*/ /*-->*/

 

There were a lot of other interesting sessions and most of them had recordings and their details can be found and viewed at https://www.drupaleurope.org/program/schedule. If you are interested in the future of the web and how Drupal plays an important role in this we suggest you take a look. If you are more into meeting people in real-time and being an active listener there is Drupalcamp Ghent (http://drupalcamp.be) at the 23rd and the 24th of November. Dropsolid is also a proud sponsor of this event.

And an additional tip: Markus’s session will also be presented there ;-)

Categories: Drupal

Google Optimize

drupal.org - Modules - Wed, 11/07/2018 - 04:01

Adds the Google Optimize web statistics tracking system to your website.

Categories: Drupal

Template Selector

drupal.org - Modules - Wed, 11/07/2018 - 03:17

This module and its sub-modules are fulfilling the need to have a template selector for content types using a standard Drupal entities.

The Problem

Drupal is a great content management framework for developers but it lacks an essential part that other frameworks provide which make the mission of the Site builders and content admins easier that is related to select a template for each content type out of the box.

Categories: Drupal

Chart.js Field

drupal.org - Modules - Tue, 11/06/2018 - 20:27

This module creates a field type for displaying charts utilizing the Chart.js. This module is different than other modules using charting and graphing libraries because it creates a field type.

Categories: Drupal

jmolivas.com: BADCamp 2018 wrapup

drupal.org aggregator - Tue, 11/06/2018 - 19:00
BADCamp 2018 wrapup Last week I attended BADCamp and as usual, I can confirm firsthand that BADCamp keeps being a blast. I will mention some of the reasons why. The Summits I had a chance to attend DevOps and Front-end Summits half day each. During such summits, participants shared their experiences about the tools and techniques used regularly while working with clients. While at the DevOps Summit, it was great to hear that a lot of developers are interested in Kubernetes. Also, it was interesting to hear conversations about CI/CD workflows and the different tools used when building…
Categories: Drupal

Wim Leers: BigPipe's strength: available to all

drupal.org aggregator - Tue, 11/06/2018 - 16:51

I’ve been running a lot lately, and so have been listening to lots of podcasts! Which is how I stumbled upon this great episode of the Lullabot podcast recently — embarrassingly one from over a year ago: “Talking Performance with Pantheon’s David Strauss and Josh Koenig”, with David and Josh from Pantheon and Nate Lampton from Lullabot.

(Also, I’ve been meaning to blog more, including simple responses to other blog posts!)

Interesting remarks about BigPipe

Around 49:00, they start talking about BigPipe. David made these observations around 50:22:

I have some mixed views on exactly whether that’s the perfect approach going forward, in the sense that it relies on PHP pumping cached data through its own system which basically requires handling a whole bunch of strings to send them out, as well as that it seems to be optimized around this sort of HTTP 1.1 behavior. Which, to compare against HTTP 2, there’s not really any cost to additional cost to additional connections in HTTP 2. So I think it still remains to be seen how much benefit it provides in the real world with the ongoing evolution of some of these technologies.

David is right; BigPipe is written for a HTTP 1.1 world, because BigPipe is intended to benefit as many end users as possible.

And around 52:00, Josh then made these observations:

It’s really great that BigPipe is in Drupal core because it’s the kind of thing that if you’re building your application from scratch that you might have to do a six month refactor to even make possible. And the cache layer that supports it, can support lots other interesting things that we’ll be able to develop in the future on top of Drupal 8. […] I would also say that I think the number of cases where BigPipe or ESI are actually called for is very very small. I always whenever we talk about these really hot awesome bleeding-edge cache technologies, I kinda want to go back to what Nate said: start with your Page Cache, figure out when and how to use that, and figure out how to do all the fundamentals of performance before even entertaining doing any of these cutting-edge technologies, because they’re much trickier to implement, much more complex and people sometimes go after those things first and get in over their head, and miss out on a lot of the really big wins that are easier to get and will honestly matter a lot more to end users. “Stop thinking about ESI, turn on your block cache.”

Josh is right too, BigPipe is not a silver bullet for all performance problems; definitely ensure your images and JS are optimized first. But equating BigPipe with ESI is a bit much; ESI is indeed extremely tricky to set up. And … Drupal 8 has always cached blocks by default. :)

Finally, around 53:30 David cites another reason to stress why more sites are not handling authenticated traffic:

[…] things like commenting often move to tools like Disqus and whether you want to use Facebook or the Google+ ones or any one of those kind of options; none of those require dynamic interaction with Drupal.

Also true, but we’re now seeing the inverse movement, with the increased skepticism of trusting social media giants, not to mention the privacy (GDPR) implications. Which means sites that have great performance for dynamic/personalized/uncacheable responses are becoming more important again.

BigPipe’s goal

David and Josh were being constructively critical; I would expect nothing less! :)

But in their description and subsequent questioning of BigPipe, I think they forget its two crucial strengths:

BigPipe works on any server, and is therefore available to everybody, and it works for many things out of the box, including f.e. every uncacheable Drupal block!

Bringing this optimization that sits at the intersection of front-end & back-end performance to the masses rather than having it only be available for web giants like Facebook and LinkedIn is a big step forward in making the entire web fast.

Using BigPipe does not require writing a single line of custom code; the module effectively progressively enhances Drupal’s HTML rendering — and turned on by default since Drupal 8.5!

Conclusion

Like Josh and David say: don’t forget about performance fundamentals! BigPipe is no silver bullet. If you serve 100% anon traffic, BigPipe won’t make a difference. But for sites with auth traffic, personalized and uncacheable blocks on your Drupal site are streamed automatically by BigPipe, no code changes necessary:

(That’s with 2 slow blocks that take 3 s to render. Only one is cacheable. Hence the page load takes ~6 s with cold caches, ~3 s with warm caches.)

Categories: Drupal

I'm having trouble with Node Grants

Drupal - Open Source Content Platform - Tue, 11/06/2018 - 14:32

I was following this guide for writing a module that handles node access. I'm trying to restrict access to site content for some users: Mexico users should only see Mexico content.

Here's my code:

/** * Implements hook_node_access_records(). */ function aat_user_management_node_access_records($node) { $grants = []; $node_wrapper = entity_metadata_wrapper('node', $node); if ($node_wrapper->getBundle() == 'site') { if(!empty($node_wrapper->field_address)) { if ($node_wrapper->field_address->country->raw() != 'MX') { $grants[] = array( 'realm' => 'site_access', 'gid' => 120, 'grant_view' => 0, 'grant_update' => 0, 'grant_delete' => 0, 'priority' => 0, ); } } } return $grants; } /** * Implements hook_node_grants(). */ function aat_user_management_node_grants($account, $op) { $grants = []; // Mexico users can only view mexico sites if (in_array('mexico_user', $account->roles)) { $grants['site_acess'] = [120]; } return $grants; }

And this is the error I'm getting:

EntityMetadataWrapperException: Unable to get the data property country as the parent data structure is not set. in EntityStructureWrapper->getPropertyValue()

Help me reddit, you are my only hope!

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

How can I display the user that last modified content instead of the original author?

Drupal - Open Source Content Platform - Tue, 11/06/2018 - 14:00

On the /admin/content page there is a column for Author that displays the person that created the content. Is there a way to instead show the person that last modified the content? I know that information is stored with revisions of the content, and would like to know how to surface that in the content view. Is that possible? Alternatively is there a hook I can implement to modify the view on the fly?

I'm using Drupal version 8.5.6, currently.

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

Pages