Elsewhere

Localize.drupal.org: Looking for translation teams to test the User Guide translation process

Planet Drupal - Wed, 20/07/2016 - 11:02

There has been some amazing work on a User Guide for Drupal 8 for about a year now, and the English version is in pretty good shape -- it's in the stage now of copy editing and image refinement, and it will find its home under drupal.org/documentation. To start the translation process off, we need to figure out a translation workflow that will make sense for translation teams. It doesn't make sense to use the same workflow as is used on https://localize.drupal.org for the short strings that are part of Drupal and contributed modules, themes, and distributions (see https://www.drupal.org/node/2762261 for details) -- the guide is about 100 pages of formatted text prose, not a bunch of short strings.

We are looking for one or two teams initially to start using a proposed process for translation and provide honest feedback to improve the flow. This will help get the guide translated to as many languages as possible eventually.

More information and contact details at https://groups.drupal.org/node/512691

News tags: D8MI newsDrupal planetSite news
Categories: Elsewhere

Don't Panic: A blog about Drupal: Adding language id to the body class in Drupal 8

Planet Drupal - Wed, 20/07/2016 - 09:06

When I started making sites with Drupal 8 I missed a special body class that I sometime need for theming as well as other times, and that's the language body class. When making multilingual sites this comes in handy sometimes. For Drupal 7 this was made possible by the Internationalization (i18n) module, but since that module has been moved into core in Drupal (source) that special body-class-adding-thingamajig seems to have vanished.

After facing the need of language id when making this site I started to search for a solution, but came up with very few answers. When I solved it I thought I could make a short entry to spread the knowledge.

My needs

Basically, I had two needs for the language class to be added to my theme. 

  1. I wanted to hide some of the meny items depending on which language the content was presented in. (I later solved this in another way in my theme, but that was the initial need for a body class representing the current language.)
  2. I have two different RSS-feeds, one for posts in English and one for posts in Swedish. To make it work 100%, the path to the feed needed the language id as well. This was the latter need for me, and also the need that made it to the final site.
The theme

The themes I've used for Drupal 8 haven't had the language flag/path, but some themes may have implemented it, so if you have the path in the body class then you probably don't need to read this.

The example I'm going to show you is from the the Bootstrap Clean Blog, which I use for this site, and I will show you the code for adding the language id to it.

The files

In the theme folder of Bootstrap Clean Blog you need to locate two files:

  • bootstrap_clean_blog.theme, which is in the root of the theme folder called bootstrap_clean_blog and
  • html.html.twig which is located in the templates folder.

In bootstrap_clean_blog.theme (or any other .theme-file you might have in the theme you're using/developing) add the following code snippet to it:

function bootstrap_clean_blog_preprocess_html(&$variables) { $language = \Drupal::languageManager()->getCurrentLanguage()->getId(); $variables['language'] = $language; }

If you're using a different theme than Bootstrap Clean Blog, the name of the theme-file is something like XYZ.theme, where XYZ is the name (lowercase with underscores) of the theme. For example, if you're using the Pixture Reloaded theme, the theme-file is called pixture_reloaded.theme.

The code above calls for the language by getCurrentLanguage() and assigns the value to the variable $language. After that the value of $language is assigned to the global variable array $variables['language'].
You could shorten this down to

function bootstrap_clean_blog_preprocess_html(&$variables) { $variables['language'] = \Drupal::languageManager()->getCurrentLanguage()->getId(); }

but I wrote it on two separate rows to make it more clear. The shorter code snippet is quite allright, though, and you can use that in your .theme-file.

Next up: The TWIG-file

Allright, so far we've collected the language and stored it in a global variable. Now it's time to make it visible on the webpage, to print it. This is done via TWIG, a fast and secure template engine that Drupal 8 started using. To print the $variables['language'] you write the following "twig code" in your template where you want it to be printed.

{{ language }}

So, in my example, if we want to print it in the body class, I open up the template html.html.twig in the templates folder of the theme and search for the line where the body is set. It looks like this:

<body{{ attributes.addClass(body_classes) }}>

It prints the following HTML when rendered in a browser:

<body class="user-logged-in path-frontpage">

Though, we can't just add {{ language }} to the body tag since it won't be a part of the {{ attributes.addClass(body_classes) }}. Those are set a couple of lines up, but it's easy to fix it. They look like this:

{% set body_classes = [ logged_in ? 'user-logged-in', not root_path ? 'path-frontpage' : 'path-' ~ root_path|clean_class, node_type ? 'node--type-' ~ node_type|clean_class, ] %}

In i similar way we add:

language ? 'lang-' ~ language|clean_class,

so the final result looks like this:

{% set body_classes = [ logged_in ? 'user-logged-in', not root_path ? 'path-frontpage' : 'path-' ~ root_path|clean_class, node_type ? 'node--type-' ~ node_type|clean_class, language ? 'lang-' ~ language|clean_class, ] %}

Now comes the thing that's very important. After saving your theme-files, you must clear cache for the changes to appear. Click Configuration > Performance > Clear all cache. Then reload the page and check the source code of it et voilà - it works and the source code looks like this:

<body class="user-logged-in path-frontpage lang-en">

That's that. You can now use the class lang-en to distinguish your English pages and on your pages in another language it might look something like this:

<body class="user-logged-in path-node node--type-article lang-sv">

You can also use {{ language }} anywhere else, for example is you have the same need as I, to make a link language-dependant: 

<a href="/{{ language }}/feed">RSS</a>

which gives you the following complete HTML

<a href="/sv/feed">RSS</a>

or

<a href="/en/feed">RSS</a>

if the visitor is on the English part of the site.

Hope this helped you in some way. Happy drupaling!

Categories: Elsewhere

Miloš Bovan: GSoC ‘16 - Week #9: Mailhandler report

Planet Drupal - Wed, 20/07/2016 - 08:13
GSoC ‘16 - Week #9: Mailhandler report

During the 8th week of Google Summer of Code 2016, we have started with adding support for posting comments via email. After getting the feedback from my mentors, there was some space to improve proposed solution. The suggestions were accepted and briefly explained below.

Comments in a submodule

As comments are supported through new handler plugin (MailhandlerComment), we decided to move it into a submodule - mailhandler_d8_comment. Following this approach, we can avoid too many dependencies on the main module. The submodule features: Inmail config entity that represents the handler, the plugin class and the related test coverage.

Configurable referenced entity type

With configurable referenced entity type of processed comments, we can support not only node entities but all the other “commentable” entities. In my opinion, this is a nice feature for site administrators in case they want to allow posting comments (for their articles or custom entities) as easy enough as sending an email.

Strict validation

Validation is the important topic in software development in general. In Drupal 8, there is an API made specifically for entity validation - Entity Validation API. It is recommended to use it before saving an entity. However, entity validation does not work as expected in a case of creating comments via API. The referenced entity ID and its bundle were not validated which required us to find a different approach. To accomplish this, we had to implement custom validation checks. They consist of:

  • Entity type validation - entity type is “commentable”

  • Referenced entity ID validation - referenced entity with provided ID actually exists

  • Bundle validation - identified entity bundle supports comments


Last week, besides the improvements made on the comment feature, I was working on the demo module improvements. The pull request has been submitted on Github and available for review. This module serves as an example module to show features of Mailhandler. It creates a sample “Mailhandler” content type (with a body field) and a new user with permissions to add content for “Mailhandler” content type and post comments. The GPG key field of this user was populated  with a sample key (both public and private GPG keys were added to the module) as well. Since last week, the example messages - sample comment and PGP clear-signed, MIME and MIME HTML emails are part of the demo module too. By enabling mailhandler_d8_demo, exploring Mailhandler features becomes very straightforward.

Drupal 8 module demo: Mailhandler from Milos Bovan on Vimeo.

Also, the demo module adds a sample article attached to the front page. The idea is to have a descriptive article about Mailhandler features. Its content will be extended during the “documentation week”. Next week, I will be working on improving overall user experience and user interface of Mailhandler.

 

 

Milos Wed, 07/20/2016 - 08:13 Tags Open source Google Summer of Code Drupal Drupal Planet Add new comment
Categories: Elsewhere

DrupalCon News: DrupalCon Dublin Sessions Announced

Planet Drupal - Wed, 20/07/2016 - 01:29

One of the most exciting aspects of preparing for a DrupalCon is selecting the sessions that will be presented. It’s always incredibly impressive and humbling to see the great ideas that our community comes up with— and they’re all so great that making the official selections is definitely not an easy process!

Categories: Elsewhere

DrupalCon News: Six Trainings Announced to Level Up your Drupal Skills

Planet Drupal - Tue, 19/07/2016 - 23:58

This is the first European DrupalCon since Drupal 8 was launched and we are excited to offer six solid trainings that will really help level up your skills. There is a little something for everyone with trainings that span job functions and skill levels.  Check out the training courses that we will be offer ong 26 September from 9:00-17:00 at DrupalCon Dublin.  

Categories: Elsewhere

GVSO Blog: [Social API] Creating a Social Auth implementer #2 - Routes and Network Plugin

Planet Drupal - Tue, 19/07/2016 - 22:31
[Social API] Creating a Social Auth implementer #2 - Routes and Network Plugin

In the last post of this series, we started declaring our module information (social_auth_google.info.yml) and its dependencies through a composer.json file. In this post, we will move on and start working on the routing, settings form, and Settings Manager.

Routes

Now that we have let Drupal about our module and its dependencies, it is time to define our routes. In the case of our Social Auth Google module, we'll need the following social_auth_google.routing.yml file

gvso Tue, 07/19/2016 - 16:31 Tags Drupal Drupal Planet Social API
Categories: Elsewhere

GVSO Blog: [Social API] Creating a Social Auth implementer #1 - kicking off

Planet Drupal - Tue, 19/07/2016 - 22:00
[Social API] Creating a Social Auth implementer #1 - kicking off

In the last few months we have been working on the Social API project which tries to harmonize Social Networking functionality in Drupal. This project is divided in four main components which are:

gvso Tue, 07/19/2016 - 16:00 Tags Drupal Drupal Planet Social API
Categories: Elsewhere

LevelTen Interactive: Get a Free Website Valuation at the ROW Roadshow!

Planet Drupal - Tue, 19/07/2016 - 20:55

By now, you may have heard that we’re putting on a show: the ROW Roadshow, to be exact!

ROW stands for Results Oriented Websites, and it means just what it says. We think that all of our clients – and everyone in the United States! – should have a meaningful web presence, with a website that produces real results and helps them grow their company.

The ROW Roadshow is our way of taking that

...Read more
Categories: Elsewhere

Cheeky Monkey Media: Behat with Drupal - Tutorial

Planet Drupal - Tue, 19/07/2016 - 18:08
Behat with Drupal - Tutorial Anonymous (not verified) Tue, 07/19/2016 - 16:08

On our first day as interns at Cheeky Monkey, we (Jared and Jordan) were given the task of exploring the somewhat uncharted waters of using Behat, an open source BDD (Behavior-driven development) testing framework, with Drupal 7.

 

Why BDD Testing?

We all know that testing is important, but why do we bother with “BDD” testing?

Behavior-driven development testing is exactly what it sounds like, testing the behavior of the site. This makes the tests very different than say a unit test.

Categories: Elsewhere

Acquia Developer Center Blog: Drupal 8 Tutorials for Beginners

Planet Drupal - Tue, 19/07/2016 - 17:22

Maybe you are already grokking Drupal 8's new configuration management system; maybe you've already absorbed D8's embrace of object-oriented code.

But that doesn't mean you should scoff at easy on-ramp introductions to Drupal 8. Solid overviews of Drupal 8 can be tremendously valuable when you're working on a team that includes non-technical members. They also come in handy when you are advocating in-house for D8 adoption.

Tags: acquia drupal planet
Categories: Elsewhere

Zivtech: How to Use SQL-Dump and SCP

Planet Drupal - Tue, 19/07/2016 - 15:15

It’s been almost six months since I started at Zivtech as a Junior Developer, and I could never fit everything I’ve learned into one blog post. That said, one of the best things I’ve learned is how to compress my database and copy it across servers. These two commands are drush sql-dump and scp. If you’re unfamiliar with Drush, you can find some background information here.

I learned how to use drush sql-dump while using Probo.CI, which is our internally-developed continuous integration tool. Since we use Probo.CI on every project, I had to figure out how to set it up. Essentially, you have to upload your database to the Probo.CI app to ensure that your new feature will work on the site when you’re testing your pull request. Here is some helpful documentation. The fourth step in this documentation is:

Step 4: Use Drush to get and compress your database in a sql file.

If you wish to compress your database you’ll need to use gzip. Other zip files won’t work.

$ drush sql-dump | gzip > dev.sql.gz

To a new developer, this might look a little intimidating, but it’s just like it sounds; you’re dumping your database into a gzip file, dev.sql.gz, which will then be uploaded. In this example of using Probo, you’re uploading the gzip file with probo-uploader (a command line client for uploading files). Using Probo was a great entry point into learning drush sql-dump which, as you’ll see below, can be used in other capacities.

I’ve also had to use drush sql-dump alongside scp, which means secure copy. So I’ve dumped my database into a .gz file; great, but now what? Somehow I have to get the database to another environment or server. In the previous example, I didn’t need to copy the database to a server; everything could be done either locally or from my virtual machine. There are times when you need to import a database to a particular environment. If you need to copy the database from a remote host to the local host:

$ scp your_username@remotehost.edu:foobar.txt /some/local/directory

If you need to copy it from the local host to a remote host:

$ scp foobar.txt your_username@remotehost.edu:/some/remote/directory

Credit for the above examples goes to scott@hypexr.org. For more scenarios, go here.

Once you’ve copied the gzip file to the environment it needs to be in, you need to DROP your current database so you can import the new one you just copied. That’s where these commands come in:

$ drush sql-drop $ drush sql-cli < ~/my-sql-dump-file-name.sql

For more information, here’s another great resource.

That’s all there is to it. You dumped the database you wanted into a gzip file, secure copied it to the environment, dropped the old database, and then imported the new one. That’s how it works!

Categories: Elsewhere

Jim Birch: Holistic SEO and Drupal

Planet Drupal - Tue, 19/07/2016 - 11:30

The Introduction - What is Holistic SEO?

Holistic SEO is a term used to describe development in which content, marketing, technical best practices, performance, security, user experience and user intent come together to create an ideal URL on the internet, about a certain topic.

Why should we advocate taking a Holistic approach to SEO?  As search engine algorithms get more complex and intelligent, we won't be able to control or predict changes, and more importantly, it defines a set of best practices that we can develop upon which helps the content creators ultimately benefit the user.

Today's Google algorithm is putting more value on Topic and User Intent than Keywords.  Content pieces that once ranked well for ultra specific keyword terms, are quickly being, or have been replaced by much longer form content that:

  1. Answers questions the searcher has asked.
  2. Is deeply informational about a topic.
  3. Helps the user complete a transaction.
A Holistic SEO Example

Here is an example, HouseLogic.com's Guide to Hardwood Floor Finishes is listed for the following search terms:

Read more

Categories: Elsewhere

Blair Wadman: How to wrap a Drupal Views field in any HTML element

Planet Drupal - Tue, 19/07/2016 - 10:13

In Drupal Views, you can wrap a field in a basic element (such as div, span, H1, H2, p, strong). But sometimes you are going to need to wrap a field in an HTML element that is not available in the list. For example, if you have an image field that and need to wrap in a <figure> element (this is the example we will use for this tutorial). This can be pretty confusing at first, but fortunately there are a few methods available to get the job done.

Categories: Elsewhere

Janez Urevc: We had great and productive time at NYC sprint!

Planet Drupal - Tue, 19/07/2016 - 09:30
We had great and productive time at NYC sprint! slashrsm Tue, 19.07.2016 - 09:30

As you may already heard a big free software conference, Open camps happened at the United nations headquarters in New York last week. As part of the NYC Drupal camp, which was just one of the many camps that happened during it, a week-long Drupal 8 media sprint was held.

Media team had great time there and I would like to share our impressions with you.

Samuel Mortenson, Adam Hoenich and Janez Urevc in deep discussions about media. Photo by Photographic Intrinsic.

Open camps and NYC Drupal camp

Open camps conference happened for the first time this year. It is a mission-driven free software event that grew out of the NYC Drupal camp. Open camps is a week-long, community organized, non-profit conference as part of which more than 20 camps were taking place. Python, Node.js, Elixir, React, Go, Drupal, Wordpress and many others. All in one place. Pure love!

More photos available in the official Flickr group.

NYC Drupal camp has been one of the strongest supporters of the Drupal 8 Media Initiative for years. They helped us to kick the initiative off and have been supporting us in many ways since then. This year was no exception to that. Along with many media-related sessions as part of the general conference days and a dedicated media summit they also helped us organise a week-long media sprint.

Did we spend the week drinking most of the time?

Of course! Socialisation is one of the most important parts of any community. OK, that's it. Stay tuned!

I am just joking... hope you were not taking me to seriously. We spent most of the week working hard to get closer to beta releases of our most important contributed modules. A lot of extremely cool features were introduced to our browsing component, which is now much more aware of the world around it, it is able to validate your actions much more confidently and it is much easier to use it as part of your custom code.

One of our favourite modules, File entity browser, seen a lot of improvements too. It was chasing changes in the Entity browser and trying to make the most out of new features that are provided. A lot has been done in the area of UX too.

We also focused on getting to the beta release of our embedding component. Last beta blocker was finally RTBC'ed few days ago.

What is in it for me?

Besides all new features that people were asking for we made a big step forward when it comes to stabilisation of the ecosystem. We feel quite confident that we reached the state when we are really confident to release the ecosystem to the wider public.

Our plan is to release last new release of all affected modules this week. We will make sure that changes that we did are chased in all of them, which means you will be able to get latest versions and be confident that they work together. This will include last alpha versions of Entity embed and Entity browser modules. If no critical bugs are found in the two weeks time after that we will release first beta versions. This will be a huge step forward for the Drupal 8 media ecosystem, as it will result in the stabilisation of the most important and biggest modules we provide.

This will result in life of our users being much simpler. You will be able to rely on the ecosystem to just work. There will be no more changes or updates that could potentially break the sites using them.

What are the next steps?

As the ecosystem is entering more stable state we're switching our focus a bit. While developing new features and refactoring were our main focus until now we'll spend most of our energy with fixing bugs, providing support and writing documentation in the next weeks and months. We will also spend more time working on solution modules that will be much more convenient for ordinary users to start with (check File entity browser, Content browser, Media and Lightning distribution).

I'd like to thank to everyone that contributed to the Drupal 8 media ecosystem. What we achieve would not be possible without those numerous contributions. I'd also like to thank to the NYC camp. A lot of things that happened in the last two years wouldn't be possible without their support.

Want to get involved?

Hop on to IRC and poke us on #drupal-media. We also re-started our weekly meetings, which are happening every Wednesday at 16:00 on our IRC channel. Join us!

Categories: Elsewhere

PreviousNext: Injecting Dependencies into Drupal 8 plugins

Planet Drupal - Tue, 19/07/2016 - 01:50
As part of our code review process for a current project, it was suggested that rather than calling the static Drupal formBuilder function to insert a form into a custom block, we actually inject the *Form Builder service* directly into the module, and for bonus points also inject the renderer service.   I'd previously had exposure to dependency injection earlier on the same project but hadn’t exactly grokked the concept fully and so with a few pointers in the right direction, I set about refactoring the code I’d written using dependency injection and Drupal services.  
Categories: Elsewhere

DrupalCon News: Ten Grant Recipients and Scholars to Join Us at DrupalCon Dublin

Planet Drupal - Tue, 19/07/2016 - 00:31

DrupalCon is an incredible meeting place for community members from all over the globe. But it's not a free event. To make going to DrupalCon more affordable, the Drupal Association coordinates grants and scholarships. We dedicated $10,000 to helping people get to DrupalCon.

The grant and scholarship program helps community members with travel and ticket reimbursement awards. It's funded by ticket sales, membership funds, and the support of generous partners. This year, 108 people applied. Below are some interesting facts about them:

Categories: Elsewhere

Cocomore: Cocomore Job Check: What does a web producer do?

Planet Drupal - Tue, 19/07/2016 - 00:00

Interested in more agency insights? In the second part of the Cocomore Job Check we talk to web producer Kerstin Polte about what her job consists of and which challenges she has to face on a daily basis.

Categories: Elsewhere

DrupalCon News: Community Keynote: Enzo shares global community insight

Planet Drupal - Mon, 18/07/2016 - 22:20

The Drupal community is an international one, full of incredible people with amazing stories. What better platform to share those stories than DrupalCon? That's why we're so excited to have the DrupalCon Community Keynote on 29 September. A member of our community will share something that can benefit each of us.

Categories: Elsewhere

Hook 42: Node.js version control in Drupal themes

Planet Drupal - Mon, 18/07/2016 - 21:44

It is important that for any given project, each developer uses the same version of Node.js and related Javascript (JS) packages. In this article, we’ll discuss how to use “Node Version Manager” (NVM) to install multiple versions of Node.js, how to use “Automatic Version Switching for Node.js” (AVN) to automatically switch Node.js versions when changing to a project directory, and how to use “Node Package Manager” (NPM) to keep track of JS packages.

Categories: Elsewhere

FFW Agency: The ABC's of Drupal: Component, Composer, Console

Planet Drupal - Mon, 18/07/2016 - 20:15
The ABC's of Drupal: Component, Composer, Console Ray Saltini Mon, 07/18/2016 - 18:15

When we said we'd introduce you to the ABC's of Drupal we didn't just mean the easy stuff. Here are three C's that will help you understand the power behind Drupal 8.

Component: In Drupal 8 the word component is often used to identify one of the libraries managed by the Symfony project used by Drupal. Visit this link for a full list. https://ffwagency.com/blog/what-symfony-components-are-going-into-drupal-8 While Twig is often cited as a Symfony component, strictly speaking it is a PHP theming engine created by the same individuals who founded and maintain the Symfony project.

Composer: Composer is a dependency manager tool for PHP, Drupal’s core scripting language. If you are familiar with a package manager it is similar but not the same. Practically speaking Composer will help you download, install and manage specific code libraries and any additional code libraries they in turn may be dependent on for a given project. It’s important to understand that Composer is project centric - it defaults to managing code and dependencies within projects (like websites) rather than globally across projects. Composer’s use in the Drupal space is growing with the adoption of Drupal 8 and has begun to be used as an alternative to .make files which have been used to help manage Drupal installs and distributions.

Console: Console is a component of the Symfony project. Most often when a Drupal developer refers to using Console they are talking about using Drupal Console, a suite of tools run from a command line interface (CLI) to generate boilerplate code and interact with a Drupal 8 installation. In 2014 FFW hired Drupal Console’s lead project developer Jesus Olivas to develop the project and contribute the tool back to the Drupal community to strengthen Drupal 8 adoption. Drupal Console is used as a learning tool, module and theming scaffolding, debugger and configuration tool for Drupal 8. For more information on Drupal console visit https://ffwagency.com/blog/drupal-console-an-overview-of-new-drupal-cli

Tagged with Comments
Categories: Elsewhere

Pages

Subscribe to jfhovinne aggregator - Elsewhere