Newsfeeds

ComputerMinds.co.uk: Localising dates in twig templates

Planet Drupal - 14 August 2018 - 3:14am

A client noticed the dates on their news articles were not being translated into the correct language. The name of the month would always appear in English, even though all the month names had themselves been translated and showed correctly elsewhere. The problem turned out to be down to the twig filter being used in the template to format the date. This is what we did have:

{% set newsDate = node.getCreatedTime|date('j F Y') %} {% trans %} {{ newsDate }}{% endtrans %}

So this would produce something like '1 March 2018' instead of '1 März 2018' when in German. This was because twig's core date() filter simply isn't aware of Drupal's idea of language.

I switched out the date() filter and used Drupal core's own format_date() filter instead, which uses Drupal's own date.formatter service, which is aware of language. It ensures the month name is passed through t() to translate it, separately to the rest of the numbers in the date. So it now looks like this:

{% set newsDate = node.getCreatedTime|format_date('custom', 'j F Y') %} {% trans %} {{ newsDate }}{% endtrans %}

Having done that, I realise the original code was the equivalent of doing this:

t('1 March 2018');

(I'm less of a front-end coder, so putting it in PHP makes it more obvious to me than twig code!)

So the date actually was translatable, but only as the whole string -- so unless the translators had gone through translating every single individual date, the German month name was never going to show!

What I needed was the twig equivalent of using placeholders like this PHP example:

t('My name is @name, hello!', ['@name' => $name]);

When you use variables between twig's trans and endtrans tags, they really are treated by Drupal as if they were placeholders, so this is the twig version:

{% trans %} My name is {{ name }}, hello! {% endtrans %}

This helped me understand twig that little bit more, and appreciate how to use it better! Regardless of formatting dates, I now know better how to set up translatable text within templates, hopefully you do too :-)

Categories: Drupal

Images Optimizer

New Drupal Modules - 14 August 2018 - 2:51am
Introduction

The Images Optimizer module provides a simple way to optimize uploaded images.

Every uploaded image is automatically optimized if its mime type is supported by one of the registered optimizers.

We provide two basic optimizers that handle JPEG and PNG images, but you can easily create your own if they do not fit your needs.

Requirements

This module requires the following modules:

Categories: Drupal

Drupal Europe: How Publiq is using blockchain to tackle urgent challenges for publishers

Planet Drupal - 14 August 2018 - 2:40am
Drupal Europe: Publishing + Media Special Focus

What industries come to mind when you hear blockchain? Banking? Trading? Healthcare? How about publishing? At Drupal Europe publishers will gain insights into the potential blockchain technology offers and learn how they can benefit. Meet Gagik Yeghiazarian, founder of the nonprofit foundation Publiq, and learn how he wants to fight fake news and build a censorship-resistant platform — using blockchain.

The publishing world is changing. Publishers no longer solely control media distribution. Big players like Facebook and Google are middlemen between the publishers and their readers, and technology built to entice publishers — Google’s AMP (Accelerated Mobile Pages) and Facebook Instant Articles — has strengthened social platforms as distribution channels. Additionally, publishers have lost money making classifieds business as employment and real estate markets create their own platforms and portals to reach the audience.

Photo by Ian Schneider on Unsplash

As a result of these developments, publishers are losing direct relationships with their readers as well as critical advertising which traditionally supported the editorial and operational costs. The platforms act as middlemen, using the content of the publishers for collecting data and selling them to advertisers. The publishers are left out in the cold.

Critically, publishers are also facing a crisis of confidence. As social platforms are used to spread fake news and poor content, mistrust in journalism grows.

The nonprofit foundation Publiq wants to face these challenges with a blockchain-powered infrastructure. It aims at removing unnecessary intermediaries from the equation and helping to create an independent, censorship-free environment. Gagik Yeghiazarian, CEO and Co-Founder of Publiq, is convinced: “Blockchain infrastructure allows content creators, readers and other participants to build a trusted relationship.”

You can learn more about Publiq and its blockchain infrastructure at Drupal Europe in Darmstadt: Gagik Yeghiazarian’s session “Blockchain Distributed Media — A Future for good publishing” will give you a glimpse into this new technology and a real-world application of it.

While you’re at Drupal Europe, be sure to check out the exciting blockchain panel discussion where Gagik, Ingo Rübe of Botlabs, and Taco Potze of Open Social, will share insights and use cases for blockchain technology. Don’t miss this!

Drupal Europe
Publishing & Media — Track Chairs

Categories: Drupal

The Design is the Implementation - by Daniel Shumway

Gamasutra.com Blogs - 14 August 2018 - 12:33am
In Reset Hard, I eschew tricks and clever programming in favor of direct, honest systems. This allows me to design mechanics with a greater degree of consistency and flexibility.
Categories: Game Theory & Design

Superseeds: Who\'s Candlekeep?

RPGNet - 14 August 2018 - 12:00am
A look at a supernatural villain.
Categories: Game Theory & Design

Views Add Button

New Drupal Modules - 13 August 2018 - 8:57pm

Have you ever wanted to create "add" buttons with tokens from your contextual filters? Did you ever need a custom list of nodes with an add button at the top that checks for entity create access, with having to write a custom handler or put a view inside a view? Then this module is for you!

Views Add Button lets you make an "add a node" button of any content type, and you may specify CSS classes and destination parameters for your link. You may also create multiple buttons with differing parameters if needed: just add multiple instances of the button field.

Categories: Drupal

PreviousNext: Testing Drupal with WebDriver browser mode vs Headless browser mode

Planet Drupal - 13 August 2018 - 8:49pm

There is not a lot of documentation available about what's the difference between running a browser in WebDriver mode vs Headless so I did some digging...

by Jibran Ijaz / 14 August 2018

Apparently, there are two ways to run Chrome for testing:

  • As WebDriver
  • As Headless
WebDriver:

There are two ways to run Chrome as WebDriver:

Using Selenium:

Run Selenium standalone server in WebDriver mode and pass the path of ChromeDriver bin along with the config e.g. Selenium Dockerfile

This works fine with Nightwatch standard setup, \Drupal\FunctionalJavascriptTests\JavascriptTestBase and also with Drupal core's new \Drupal\FunctionalJavascriptTests\WebDriverTestBase.

Using ChromeDriver:

Run ChromeDriver in WebDriver mode e.g. chromedriver Dockerfile

This works fine with Nightwatch, JTB, and WTB.

Headless: Using Chrome

Run Chrome browser binary in headless mode. e.g. Chrome headless Dockerfile

Nightwatch is not working with this set up, at least I was unable to configure it. See https://github.com/nightwatchjs/nightwatch/issues/1390 and https://github.com/nightwatchjs/nightwatch/issues/1439 for more info. \DMore\ChromeDriver can be used to run the javascript tests.

Using ChromeDriver

Using Selenium ChromeDriver can be run in headless mode something like this:

const fs = require('fs'); const webdriver = require('selenium-webdriver'); const chromedriver = require('chromedriver'); const chromeCapabilities = webdriver.Capabilities.chrome(); chromeCapabilities.set('chromeOptions', {args: ['--headless']}); const driver = new webdriver.Builder() .forBrowser('chrome') .withCapabilities(chromeCapabilities) .build();

DrupalCI is running ChromeDriver without Selenium and testing Nightwatch and WTB on it.

Conclusion

The question is which is the best solution to run Nightwatch and JTB/WTB tests using the same setup?

  • We had seen some memory issues with Selenium containers in the past but we haven't run into any issue recently so I prefer this and you can swap Selenium container to use different browsers for testing.
  • We have also seen some issues while running ChromeDriver in WebDriver mode. It just stops working mid-test runs.
  • I was unable to get Headless Chrome working with Nightwatch but it needs more investigation.
  • Headless ChromeDriver setup on DrupalCI is quite stable. For JTB this would mean that we could use anyone from \Drupal\FunctionalJavascriptTests\DrupalSelenium2Driver and DMore\ChromeDriver.

Please share your ideas and thoughts, thanks!

For more info:

Tagged Testing, nightwatchjs, Functional Testing
Categories: Drupal

Agiledrop.com Blog: AGILEDROP: Drupal is Easy with Michael Anello

Planet Drupal - 13 August 2018 - 7:11pm
Agiledrop is highlighting active Drupal community members through a series of interviews. Learn who are the people behind Drupal projects.  This week we talked with Michael Anello. Learn about his volunteering, how successful DCO is and on what contributors he is most proud of.   1. Please tell us a little about yourself. How do you participate in the Drupal community and what do you do professionally? I am an active Drupal community member, volunteering for the Drupal Association's Community Cultivation Grants committee, the Drupal Community Working Group, and the Florida Drupal Users'… READ MORE
Categories: Drupal

Palantir: Drupal Chicago: The Decoupled Ouroboros

Planet Drupal - 13 August 2018 - 4:36pm
Drupal Chicago: The Decoupled Ouroboros July 11, 2018 brandt Mon, 08/13/2018 - 18:36 Caxy Interactive, Chicago, Illinois Drupal Chicago (official meetup site) Federated Search with Drupal, SOLR, and React (AKA the Decoupled Ouroboros)

Join Palantir's Avi Schwab for a discussion at the Drupal Chicago Meetup. He'll be going over a recent Palantir project and how we bring content from disparate sites (D7, D8, Wordpress) into a single index and then serve results out in a consistent manner, allowing users to search across all included properties. Avi will discuss how we got started with React, our process for hooking up to SOLR, and how we used Drupal to tie the whole thing together.

  • Date: Wednesday, July 11, 2018
  • Time: 5:30 - 7:30pm
  • Location: Caxy Interactive, 212 West Van Buren Street, Chicago, IL
Mon, 06/25/2018 - 12:00
Categories: Drupal

Palantir: Decoupled Days 2018

Planet Drupal - 13 August 2018 - 3:36pm
Decoupled Days 2018 August 17 - 19, 2018 brandt Mon, 08/13/2018 - 17:36 John Jay College of Criminal Justice, New York, New York Decoupled Days (Official Site)

Decoupled Drupal was a hot topic at DrupalCon Nashville, and Palantir is very excited to be Silver Sponsors of this year's Decoupled Drupal Days. Keep an eye out for Jes ConstantinePatrick Weston and Avi Schwab; they'll be attending the event and would love to hear about your recent decoupled projects. 

Federated Search with Drupal, SOLR, and React (AKA the Decoupled Ouroboros)

Avi and Jes will be presenting on Friday and giving an overview of a recent Palantir project. He'll explain how we bring content from disparate sites (D7, D8, Wordpress) into a single index and then serve results out in a consistent manner, allowing users to search across all included properties. He'll also go over how we got started with React, our process for hooking up to SOLR, and how we used Drupal to tie the whole thing together. More details can be found on the official site

  • Date: Friday, August 17, 2018
  • Time: 2:45 PM
  • Room: Aten Design Group Lecture Hall

 

Mon, 08/13/2018 - 12:00
Categories: Drupal

Gbyte blog: Get image URL from media field in twig

Planet Drupal - 13 August 2018 - 12:23pm

Apparently there are still pretty common Drupal 8 theming tasks that cannot be accomplished with the great twig_tweak module. This by the way was me giving a plug to a great little module, which makes half of all your theme preprocess hooks unnecessary.

If you would like to get the URL from an image that is trapped inside of a media entity however, you can either extract it using the aforementioned preprocess function like so:

Categories: Drupal

Bethesda reluctant to bring Elder Scrolls: Legends to systems that don't offer cross-play

Social/Online Games - Gamasutra - 13 August 2018 - 11:38am

"We can't be talking about one version of Legends, where you take your progress with you, and another version where you stay within that ecosystem or its walled off from everything else," said Hines. ...

Categories: Game Theory & Design

DrupalEasy: Market Driven Recruiting: Affinity Hiring, Train as Needed

Planet Drupal - 13 August 2018 - 11:33am
Drupal Career Online Case Study: Rosewood Marketing

Like their arboreal namesake, Rosewood Marketing is amazingly sound and particularly suited for very specific applications. Where the Rosewood tree serves to form the structure of certain fine musical instruments, billiard cues and chess pieces, Rosewood Marketing serves as a bridge for dozens of Amish and Mennonite small businesses to mainstream society. Their growth and development over the 22-year span of their success is not just in their marketing prowess, but in their inherent, sincere understanding of their client culture.    

If you really think about it, Rosewood has perhaps one of the most focused and secluded market segments in the US, which interestingly enough allows them to bring a type of diversity to the Drupal Community we don’t often consider. They do this amazingly well in their approach to business development and hiring. They first truly match new employees to their market and their company culture, and then leverage training programs to ensure the team has the skills and best practices in technology and communications to meet their business standards.  A person hired as a graphic designer receives training in tools such as Photoshop, InDesign, design principles and customer service. An online marketer receives training in analytics, SEO, and PPC, while a new manager learns time management.

Others become web developers, and as our luck would have it, DrupalEasy students and graduates. Of Rosewood’s 16 member staff, two are Drupal Career Online graduates and one new hire has just been enrolled in the upcoming Fall 2018 session.  Our new Rosewood student already has experience in Drupal 7, but needs to move forward in Drupal 8. Adrian Nolt, a 4-year employee of Rosewood and a Fall 2017 DCO graduate, explains, “Even though Stephen has...Drupal site-building experience, I recommended that he take DCO in order to acquire a common training foundation as our other Drupal developers...For me as a primarily self-taught Drupalist, DCO filled in knowledge gaps, and I would like for Stephen to experience the same joy.”

Stephen Ebersole, who was hired recently, works remotely for Rosewood, with his primary residence in Georgia, and currently living in Honduras serving his church. He, like most Rosewood employees, is a member of a Mennonite community.  Adrian explains, “Since Rosewood's target market is businesses run by members of the Plain Communities...besides the native understanding of our target market, we feel that while Drupal may be hard to learn, it is easier to pick up than people skills and a solid work ethic.”  

Adrian highlights the importance of this native understanding by explaining, “Many members of the Plain Communities are devout Christians with strong convictions...If a Rosewood team member does not...appreciate why his or her client will, for example, give up internet access in order to free himself from unnecessary temptations, he or she will not be able to make recommendations that align with our client's values. This understanding is more important to our ability to serve our clients well than expertise in a specific technology.”

Adrian continues, “...as soon as an employee has sufficient proficiency to perform basic tasks, he or she begins working on paid work, even if it means billing our clients at a reduced shop rate for a time. We believe that learning by doing is one of the most efficient ways to learn..though... can leave holes in a person's knowledge. For some of us, taking DrupalEasy's DCO course is about filling in the gaps and providing a common foundation for working together. However, it is also one of the fastest ways I know to get a Drupal beginner up to speed and productive with Drupal.”

The team at Rosewood has used video courses, but they have found for their purposes,  says Adrian, that “...many are too basic or not opinionated enough to apply to most real-life Drupal development practices.” He continues, “For example, they may teach installing Drupal 8 from a tarball, but we had already committed to a composer-driven workflow for Drupal 8 as the safest long-term bet, and I was looking for a course that teaches a professional development workflow. DrupalEasy DCO has proven to be the well-rounded, just-deep-enough training we were looking for, and as long as Drupal remains one of our specialties, we expect to consider it as part of our Drupal training regimen.”

Adrian feels the most valuable aspects of the DCO include clarifying the intersections of fields, blocks, entity types, content types, and relationships, which he says can be an "ah-ha" moment to someone just getting started. He also appreciates becoming familiar with command-line, git, local development, and views, as it is a must for success in Drupal 8, which he feels is a huge hurdle for those getting started. He adds “...the value of DCO lies in how it connects all the pieces, such as workflow, data architecture, module development, theming, and the business of Drupal, together into one comprehensive introduction to the Drupal ecosystem.”

Rosewood’s clients are primarily in the agricultural industry, or are builders, retailers, craftsmen, and small manufacturers, including small businesses such as  Vierbike, MM Weaver and Blue Ridge Furniture. The company is now going with other CMS options for simpler sites, but Adrian emphasizes,  “Drupal continues to excel at use cases that require structured data and over 30 pages. We feel that having Drupal in our tool bag allows us to provide outside-the-box marketing solutions to our clients simply by combining modules and configuring the user interface. On other platforms, competitors may need to resort to custom code or make compromises in order to use an out-of-the-box solution.”

As far as their training philosophy, that is evolving as well, according to Adrian, “In the past, we prescribed training when a person was hired or when they needed to learn something new. However, we have begun budgeting training dollars and time into our annual budgets in order to continually grow as professionals and as a company.” He continues, “Hiring and training people is a way to scale our service-based business to serve more clients. Continued education adds to our in-house skill set to allow us to serve them in more ways and more efficiently. Happy clients = successful Rosewood.” He adds, “We don't know the future, but judging by the past, we will continue to hire and train employees.”

The Fall 2018 session of Drupal Career Online starts September 3rd.  Group rates and government discounts are available. If you‘d like more information, join us for our no-cost mini-webinar Taste of Drupal on Monday, August 27.  

Categories: Drupal

Random Number Field

New Drupal Modules - 13 August 2018 - 11:18am

This module adds a new field type of 'Random Number Field'.

What is a random number field?

An integer field that when a new node/entity is created will be populated with a random integer between the min and max defined when the field type was created.

Categories: Drupal

Template Breadcrumb

New Drupal Modules - 13 August 2018 - 10:21am

This module allows a breadcrumb to be inserted into a nodes display settings, so it can be output as a field in the template using content.template_breadcrumb.

Dependency

This module relies on the following patch for easy_breadcrumb: https://www.drupal.org/project/easy_breadcrumb/issues/2979021

Categories: Drupal

Token Default

New Drupal Modules - 13 August 2018 - 10:16am

Allows a token to be given a default value in the event of no value being found.

This can be altered per content type.

Installation

After installing this module it can be configured from the Token Defaults menu item in the configuration list.

Categories: Drupal

Video Game Deep Cuts: We, Happy To Take The Magic Leap - by Simon Carless

Gamasutra.com Blogs - 13 August 2018 - 9:25am
This week's highlights include impressions of the much-pivoted We Happy Few, hands-on with the vaunted Magic Leap AR glasses, and lots more besides.
Categories: Game Theory & Design

The Dangers of the Echo Chamber Effect on Game Development - by Josh Bycer

Gamasutra.com Blogs - 13 August 2018 - 8:54am
Today's post looks at the echo chamber effect and how it can hurt your changes of making the best possible version of your video game.
Categories: Game Theory & Design

Coffee Talk Devlog #1: How the game came to be - The seed, the anxiety, and the belief of design by subtraction - by Mohammad Fahmi

Gamasutra.com Blogs - 13 August 2018 - 8:49am
We talk about the background of our latest project, Coffee Talk, and how Fumito Ueda's philosophy influenced us.
Categories: Game Theory & Design

Drupal Europe: Drupal Europe: Publishing + Media Special Focus

Planet Drupal - 13 August 2018 - 8:48am
Digital Assets Management in multi-channel publishing environments

Drupal Europe offers up a plethora of cases and solutions to help you with your DAM integration.

Multichannel publishing by Oleksiy Mark on Shutterstock

With so much to organize and store, publishers typically use Digital Asset Management Systems (DAM) to manage their assets. Add multiple channels to the mix and you have big operational hurdles. Thanks to the Media Initiative, Drupal now has a well-defined ecosystem for media management and its architecture is designed to play well with all kinds of media, media management systems, and web services that support them. The system is highly adaptable — the media management documentation outlines 15 modules shaping Drupal’s new ecosystem for media assets.

The Drupal Europe program offers several sessions to help you learn more about solutions building on this foundation. Case studies of demanding media management projects around the publishing industry include:

Blockchain — why should publishers care?

How Publiq is using blockchain to tackle urgent challenges for publishers

What industries come to mind when you hear blockchain? Banking? Trading? Healthcare? How about publishing? At Drupal Europe publishers will gain insights into the potential blockchain technology offers and learn how they can benefit. Meet Gagik Yeghiazarian, founder of the nonprofit foundation Publiq, and learn how he wants to fight fake news and build a censorship-resistant platform — using blockchain.

The publishing world is changing. Publishers no longer solely control media distribution. Big players like Facebook and Google are middlemen between the publishers and their readers, and technology built to entice publishers — Google’s AMP (Accelerated Mobile Pages) and Facebook Instant Articles — has strengthened social platforms as distribution channels. Additionally, publishers have lost money making classifieds business as employment and real estate markets create their own platforms and portals to reach the audience.

Photo by Ian Schneider on Unsplash

As a result of these developments, publishers are losing direct relationships with their readers as well as critical advertising which traditionally supported the editorial and operational costs. The platforms act as middlemen, using the content of the publishers for collecting data and selling them to advertisers. The publishers are left out in the cold.

Critically, publishers are also facing a crisis of confidence. As social platforms are used to spread fake news and poor content, mistrust in journalism grows.

The nonprofit foundation Publiq wants to face these challenges with a blockchain-powered infrastructure. It aims at removing unnecessary intermediaries from the equation and helping to create an independent, censorship-free environment. Gagik Yeghiazarian, CEO and Co-Founder of Publiq, is convinced: “Blockchain infrastructure allows content creators, readers and other participants to build a trusted relationship.”

You can learn more about Publiq and its blockchain infrastructure at Drupal Europe in Darmstadt: Gagik Yeghiazarian’s session “Blockchain Distributed Media — A Future for good publishing” will give you a glimpse into this new technology and a real-world application of it.

While you’re at Drupal Europe, be sure to check out the exciting blockchain panel discussion where Gagik, Ingo Rübe of Botlabs, and Taco Potze of Open Social, will share insights and use cases for blockchain technology. Don’t miss this!

Drupal Europe
Publishing & Media — Track Chairs

Categories: Drupal

Pages

Subscribe to As If Productions aggregator