Planet Drupal

Subscribe to flux Planet Drupal
Drupal.org - aggregated feeds in category Planet Drupal
Mis à jour : il y a 50 min 42 sec

Acquia Developer Center Blog: Live from DrupalCon Mumbai: Meet Acquia Pune!

jeu, 21/07/2016 - 23:03

A conversation from DrupalCon Asia DrupalCon Mumbai 2016 with members of Acquia's Pune, India office: Prassad Shirgaonkar, Prassad Gogate, Prafful Nagwani, and Jeffrey A. "jam" McGuire in which we touch on Drupal and community in India, the history of the DrupalCon Prenote, Drupal's multilingual strengths, the Drupal Campus Ambassador Program in India, and more!

jam: We are at the Contribution Sprint day of DrupalCon Asia in Mumbai, wrapping up a great few days for me. Prafful Nagwani, how was your DrupalCon?

Prafful Nagwani: This is my third DrupalCon and this was fantastic. Even more so because this is happening in India, in our own backyard, it has been really, really great the way it’s been organized. The sessions, everyone coming in, meeting each other and stuff, it’s been fantastic.

jam: So I would like to point out ... really a huge thank you to the Drupal Association and everyone involved in the organization because it was incredibly smooth and I’ve been to cons in Europe and America that were nowhere near as well-organized so: fantastic. Thank you Drupal Association.

Prafful Nagwani: Thank you.

jam: Prasad?

Prasad Shirgaonkar: Yes.

jam: How was your DrupalCon?

Prasad Shirgaonkar: It was a dream come true for me. I first did a DrupalCon in London in--I think it was 2011 or 12--and I’ve seen you doing the Prenote. I had met Jacob [Singh] and Dries with whom I work now. From that time, I wanted to do a Prenote with you and I wanted to have that done in India and it happened.

jam: Wow, that’s cool! So we did a Prenote in London called ... so there’s a Dickens’ story called A Christmas Carol and we did a parody of A Christmas Carol and we had the Ghost of DrupalCon Past and the Ghost of DrupalCon Present and the Ghost of DrupalCon Future and it was hilarious and we got chx, the contributor C-H-X to be the Ghost of DrupalCon Past and he was hilarious ... and the whole thing actually ...Prenote I’m so glad you were there! We never talked about this. So Prasad and I organized the Prenote which is a DrupalCon tradition now where it’s an opening introduction sort of a welcome to DrupalCon before Dries’ Driesnote. Prasad and I, as well as Adam Juran and Campbell Vertesi and Parth Gohil and Ashwini Kumar; we wrote it as a team together. We were very concerned frankly about making sure it would be funny in India, right? So Prasad and the Indian team hooked us up with great jokes and concepts and I think we rode the line really well of ... frankly, I don’t know everything that’s going to be offensive in India, right?

Prasad Shirgaonkar: Absolutely, absolutely.

jam: So we were really concerned.We wanted to be funny maybe even edgy, right, but not upset people. So how did you feel when we did tongue twisters with an India accent?

Prasad Gogate: Absolutely that was amazing. I think everybody enjoyed that and people probably were not expecting that. So it was really a surprise for them which was obviously a good surprise. Overall, I think DrupalCon in India has been an awesome experience here now. I think it is a dream come true for the entire India community because – and most important is I think the India community has started getting recognized and it’s growing. That’s why – I think that is more important.

jam: So we didn’t quite managed to do this yet. Please introduce yourself to everyone.

Prasad Gogate: I am Prasad Gogate. I work from Pune for Acquia.

Prasad Shirgaonkar: I’m Prasad Shirgaonkar. I work for Acquia from Pune from my home.

jam: So you’re Prasad zero, right?

Prasad Shirgaonkar: Yes.

jam: You’re Prasad one?

Prasad Gogate: Yes.

jam: Okay.

Prafful Nagwani: Hi. I am Prafful Nagwani and I work for Acquia from Pune office. I have been in Drupal since - eight years now since Drupal 6. Yes.

jam: How did you discover Drupal?

Prafful Nagwani: It happened – I got a job and they said that you need to work on something called PHP. I never worked on PHP until then. So I said, “Okay. Let’s try it out.” Since then, I have been with Drupal. I never worked – before that I was totally working on Microsoft Technologies. I never worked on any of the other open source things. I knew about Joomla. I had read about Drupal, but that’s how my experience started and since then I’m here. I’m not going anywhere.

jam: So eight years. How long have you been doing Drupal, Prasad?

Prasad Shirgaonkar: Ten years, since Drupal 4.7.

jam: I installed Drupal 4.6 but I didn’t really do anything with it.

Prasad Shirgaonkar: I did my first site. Actually, I discovered Drupal because I wanted to do my poetry website in Mahrati and back in 2005, 2006, Drupal was the only CMS which supported non-English characters.

jam: Wait, wait. The only CMS?

Prasad Shirgaonkar: Yes. So I had downloaded a couple of others and they didn’t support Unicode characters really well. So Drupal was the only one which supported Unicode ever since its birth actually.

jam: Right. This is a great segue-way into: Hey, Drupal 8 has been released and the multilingual internationalization support is unbelievable! If anybody hasn’t tried this yet, to get a fully, fully, fully translated site in Drupal 7, you couldn’t because there are certain things, variables and certain things that you couldn't touch ... but you could come the very, very closest by installing somewhere between 21 and 27 modules, right?

Prasad Shirgaonkar: Yes.

jam: Hands up who knows how many modules you have to install into Drupal 8 to make it fully multilingual? Every single thing translatable, how many modules do I have to install?

Prasad Shirgaonkar: [faint] Nothing apart from core ...

jam: No. Give me a number. How many modules?

Prafful Nagwani: Three.

Prasad Shirgaonkar: Four.

jam: I thought you guys work with Drupal. The correct answer is zero modules. So because core has?

Prasad Gogate: Multilingual.

jam: Right. Four modules that you turn on ... so amazing. So to do that site today, right, would be even easier. So Prasad, how long have you been doing Drupal?

Prasad Gogate: Since four years now, four plus years. So I was introduced when I started working for a company it was like first project for me and Drupal. I never came across it. So from that stage, I learned and then four years I have been working.

jam: What’s your favorite thing about Drupal?

Prasad Gogate: Building sites faster.

jam: Okay. What technologies did you work in before?

Prasad Gogate: It was Arc.js and Microsoft.

jam: Okay. Do you have a favorite Drupal module?

Prafful Nagwani: That’s a tough one. That’s a tough one. I think I like Views and Panels. I would go for those.

jam: Okay.

Prasad Shirgaonkar: Views, all the way Views and just Views: every sub-system, all the ecosystem around Views.

jam: Right. Another plug for Drupal 8, Views was the key differentiator for us since Drupal 5 that really sets up apart from other CMSs as well as our multilingual support apparently. Now, it’s in core, too, which means we can actually abstract it out, make other interfaces, another tools rely on it. That’s pretty cool.

This is the Acquia Pune office. We had an Acquia India sort of a gathering as part of DrupalCon the other day. How many people work for Acquia India now?

Prasad Gogate: Around more than 25.

jam: So three, four in Pune?

Prasad Gogate: Four in Pune.

jam: How many in Delhi?

Prasad Gogate: The rest, everyone is Delhi.

jam: So when is the Pune office going to overtake Delhi and become the true center of Acquia India?

Prasad Shirgaonkar: As far as leadership is concerned, that is the true center right now. Thought leadership is concerned, that is but number-wise who cares about quantity, when quality is there? ;-)

jam: So one thing I’ve noticed about the Indian community is that India is such a huge, huge, huge, huge place. I’ve met really wonderful local community leaders from all different parts of the country and there’s not a national organization per se, but it feels to me like the communication between the different groups is actually pretty strong. What’s up in Drupal today in India?

Prasad Gogate: In terms of work? You mean Acquia India or overall ... ?

jam: Drupal in India.

Prasad Gogate: I think we have been working in two various sectors. Mostly I think more of the SI and big companies are also getting involved and lot of commerce and contributions are happening. So I think people are becoming more and more knowledgeable, I would say. More and more awareness is increasing which is obviously a good thing and growth definitely is the word, I would say.

jam: Growth?

Prasad Gogate: Yes.

Prasad Shirgaonkar: I think about eight years ago we had very small pockets in Pune, in Delhi and possibly in Ahmedabad ... and in IIT Mumbai obviously.

jam: Ahmedabad was the first user group I think in India.

Prasad Shirgaonkar: Yes. That was the first user group.

Prafful Nagwani: First Drupal Camp in India was Ahmedabad in 2008.

Prasad Shirgaonkar: 2009 was in Pune.

Prafful Nagwani: Pune. That 300 people attended the 2009 and I think we had someone from US visiting and talking there.

Prasad Shirgaonkar: Yes. It was Berry ...

jam: Addison.

Prafful Nagwani: Addison Berry.

jam: You said Barry and I was about to say Barry Jaspan but no, and that’s when she was travelling around on the Knight Foundation grant.

Prasad Shirgaonkar: Yes. We had a code sprint actually in 2009 at that time in January, I remember. That was my first community interaction in Pune where I met Prafful and a lot of - Dipen. We have been ever since doing Drupal camps. Prafful has been – Prafful and Dipen had been like instrumental in setting up community. Prafful drives community like – it’s his own like homely household duty and he gets everyone together. He gets like – yes, he literally, many of the times he shouts at people if they are not doing work.

Prafful Nagwani: There are a lot of community leaders in India. I think the good part with India that’s happening is everyone shares things with each other. So if there is a camp that’s happening in Pune, I’m definitely--I have seen this and we have done this--Delhi comes to help and Bangalore comes to help and we share things. We share resources: "Okay. This is how we did the budget. This is how we did the sponsor. This is the users. This is my user group. Go ahead. Mail them." So I don’t have to start from scratch. Anyone in India wanting to do a Drupal camp, they have a head start. There are people who help out.

jam: I see.

Prasad Gogate: I think that is the community spirit which is actually shown that everybody wants the camp to be successful no matter where it is.

jam: I’ve heard about a lot of that happening and for example Parth Gohil, he has an actual job to just help as many people as possible. Someone came up to me yesterday at the DrupalCon and told me ... he told me a Veda in Sanskrit and he said open source is essential. It’s absolutely the best possible fit for Indian culture because giving and sharing are our core values as a nation and the Veda he read me was something like, "Give a man food and he’ll be satiated for a few hours but give him knowledge," right, and of course it was put much more elegantly but essentially, "knowledge will help you fill your life forever." I’m definitely going to use that in slides with the proper Sanskrit on it forever because it was so moving. Anyway, I’m having an absolutely splendid time in India just being so impressed with the Con and with the community, the number of young people. Frankly, can you talk a little bit about the gender balance in the developer community in India? I’ve seen a lot of women in terms of percentage much, much more than I see in a lot of communities around the world.

Prafful Nagwani: Yes. I think good thing happening over here is that the community overall has been pretty much welcoming everyone into the community and ready to help. As it was said by Danese in her keynote like people here have open minds. Nobody is above someone or below someone. We are all at equal level and that is what is driving people to get more into getting started with community. So for an example, we started doing meet-ups regularly in Pune and over a period of six months we have about 400 attendees, aggregated over six months. Lot of these, I think a lot of these were women. Yes. They really feel a part of it because it’s the community that drives things together, right?

jam: In the west, in open source and it’s a known problem, we have a diversity problem, very, very often. Here, I don’t see that in terms of religion and gender and age. I’ve seen a real – I’ve seen people who are definitely in their 60s at DrupalCon and definitely seen people in their early 20s or younger. I’m very impressed by that. The places that I’ve seen that before are places like Bulgaria. So post-communist countries who have a really strong engineering tradition, a really strong educational tradition over decades. So anyway, well done India because it’s great. It’s very inspiring.

What’s next for Drupal in India?

Prasad Shirgaonkar: We strongly believe that there should be a nationwide meet-up every year if not DrupalCon every year in India.

jam: So I know a guy who would like to be invited if you’re doing anything interesting I can – I’ll introduce you.

Prasad Shirgaonkar: Yes, yes. Please, please do.

jam: So Acquia Pune, thank you guys so, so, so much for taking the time to talk with me. I really can’t wait to see you again soon. Anything, any last words, anything you want to promote, push, say?

Prasad Gogate: Yes. I mean thanks to you for this and definitely, we would expect that you come to Pune once but one thing that probably I want to mention it over here is one of the important things in the Drupal community that recently is happening is more and more educational organizations have started taking interest and I think that is the root. I mean if we start giving education for Drupal from that stage, I think we’ll build a definitely a very good community.

jam: I’m glad you brought that up because I had forgotten, one of the very impressive things that I’ve seen here in India is huge community effort to bring Drupal into high schools and into universities and this is another challenge that I’ve – the efforts that I’ve been involved in, it’s been very, very difficult for us. India is now producing young software engineers who know Drupal and who like Drupal and it’s really, really exciting that you are solving the pipeline problem and everyone else out there, you need to come and see what the Indians are doing because it’s just, just right. Catch them at 15, 16. Get them excited about the web and we can have them. Prasad, shameless plug?

Prasad Shirgaonkar: No. It’s exactly the same thing I was going to say. The universities and colleges are so important and we need to have Drupal over there. So we are – actually we are in talks with IIT. They have open education resources project where they have a software project, software education translated to like 15 Indian languages and we are planning to provide a Drupal content to them. So that way, Drupal will reach to the most - remotest corner of India in their own language.

jam: Please let me know when that is happening. I’d love to help promote that.

Prasad Shirgaonkar: Absolutely.

jam: Prafful?

Prafful Nagwani: Again, the focus is on the education systems. So India community recently started the DCAP program, the Drupal Campus Ambassador Program which is in pilot phase. I think what we need to immediately do and we are trying to do is get students connected to people and they know where to go. They are not left somewhere looking around, okay, what to do next. That is where we lose them.

jam: Take them by the hand and bring them to the goal.

Prafful Nagwani: Show them the way. Show them. If they take Drupal as a career, definitely a good choice for them but we need to tell them, yes, Drupal has a career option. It’s not that only Microsoft or other technologies have that.

jam: Listen, we run 2% of the web, 5% of sites with identifiable CMS and it’s only going to get bigger. You’ve got a job here. ... Prafful.

Prafful Nagwani: Thank you so much.

jam: Prasad.

Prasad Shirgaonkar: Thank you so much.

jam: Prasad.

Prasad Gogate: Thank you so much.

jam: Zero, one. Thank you guys for taking the time to talk with me. It’s been really, really great to spend time together. I can’t wait to see you next time. Thanks, guys.

Prasad Shirgaonkar: Thanks.

Prafful Nagwani: Thanks.

Prasad Gogate: Thank you. Bye.

Skill Level: BeginnerIntermediateAdvanced
Catégories: Elsewhere

Janez Urevc: Blog design refreshed

jeu, 21/07/2016 - 20:52
Blog design refreshed

Today I am very excited! A while ago I asked my friend David Ličen to help me improve appearance and UX for my personal blog. He carefully observed my desires and added some of his own ideas. When we agreed on the initial mock he proceeded with the theme implementation.

He finished his part a while ago. I needed to tweak few other things on the back-end too, which took me way too long to do. Today I finally decided to finish this and deployed the changes to the live website.

How do you like it?

slashrsm Thu, 21.07.2016 - 20:52 Tags Drupal Enjoyed this post? There is more! janezurevc.name runs on Drupal 8! We had great and productive time at NYC sprint! Sam Morenson is thinking about media in Drupal core

View the discussion thread.

Catégories: Elsewhere

Drupal Blog: City of Boston launches Boston.gov on Drupal

jeu, 21/07/2016 - 19:00

Republished from buytaert.net

Yesterday, the City of Boston launched its new website, Boston.gov, on Drupal. Not only is Boston a city well-known around the world, it has also become my home over the past 9 years. That makes it extra exciting to see the city of Boston use Drupal.

As a company headquartered in Boston, I'm also extremely proud to have Acquia involved with Boston.gov. The site is hosted on Acquia Cloud, and Acquia led a lot of the architecture, development, and coordination. I remember pitching the project in the basement of Boston's City Hall, so seeing the site launched less than a year later is quite exciting.

The project was a big undertaking, as the old website was 10 years old and running on Tridion. The city's digital team, Acquia, IDEO, Genuine Interactive, and others all worked together to reimagine how a government can serve its citizens better digitally. It was an ambitious project as the whole website was redesigned from scratch in 11 months; from creating a new identity, to interviewing citizens, to building, testing and launching the new site.

Along the way, the project relied heavily on feedback from a wide variety of residents. The openness and transparency of the whole process was refreshing. Even today, the city made its roadmap public at http://roadmap.boston.gov and is actively encouraging citizens to submit suggestions. This open process is one of the many reasons why I think Drupal is such a good fit for Boston.gov.

More than 20,000 web pages and one million words were rewritten in a more human tone to make the site easier to understand and navigate. For example, rather than organize information primarily by department (as is often the case with government websites), the new site is designed around how residents think about an issue, such as moving, starting a business or owning a car. Content is authored, maintained, and updated by more than 20 content authors across 120 city departments and initiatives.

The new Boston.gov is absolutely beautiful, welcoming and usable. And, like any great technology endeavor, it will never stop improving. The City of Boston has only just begun its journey with Boston.gov—I’m excited see how it grows and evolves in the years to come. Go Boston!

Last night, there was a launch party to celebrate the launch of Boston.gov. It was an honor to give some remarks about this project alongside Boston mayor, Marty Walsh (pictured above), as well as Lauren Lockwood (Chief Digital Officer of the City of Boston) and Jascha Franklin-Hodge (Chief Information Officer of the City of Boston).

Catégories: Elsewhere

Dries Buytaert: City of Boston launches Boston.gov on Drupal

jeu, 21/07/2016 - 18:50

Yesterday the City of Boston launched its new website, Boston.gov, on Drupal. Not only is Boston a city well-known around the world, it has also become my home over the past 9 years. That makes it extra exciting to see the city of Boston use Drupal.

As a company headquartered in Boston, I'm also extremely proud to have Acquia involved with Boston.gov. The site is hosted on Acquia Cloud, and Acquia led a lot of the architecture, development and coordination. I remember pitching the project in the basement of Boston's City Hall, so seeing the site launched less than a year later is quite exciting.

The project was a big undertaking as the old website was 10 years old and running on Tridion. The city's digital team, Acquia, IDEO, Genuine Interactive, and others all worked together to reimagine how a government can serve its citizens better digitally. It was an ambitious project as the whole website was redesigned from scratch in 11 months; from creating a new identity, to interviewing citizens, to building, testing and launching the new site.

Along the way, the project relied heavily on feedback from a wide variety of residents. The openness and transparency of the whole process was refreshing. Even today, the city made its roadmap public at http://roadmap.boston.gov and is actively encouraging citizens to submit suggestions. This open process is one of the many reasons why I think Drupal is such a good fit for Boston.gov.

More than 20,000 web pages and one million words were rewritten in a more human tone to make the site easier to understand and navigate. For example, rather than organize information primarily by department (as is often the case with government websites), the new site is designed around how residents think about an issue, such as moving, starting a business or owning a car. Content is authored, maintained, and updated by more than 20 content authors across 120 city departments and initiatives.

The new Boston.gov is absolutely beautiful, welcoming and usable. And, like any great technology endeavor, it will never stop improving. The City of Boston has only just begun its journey with Boston.gov - I’m excited see how it grows and evolves in the years to come. Go Boston!

Last night there was a launch party to celebrate the launch of Boston.gov. It was an honor to give some remarks about this project alongside Boston Mayor Marty Walsh (pictured above), as well as Lauren Lockwood (Chief Digital Officer of the City of Boston) and Jascha Franklin-Hodge (Chief Information Officer of the City of Boston).
Catégories: Elsewhere

Mediacurrent: Think First, Then Design

jeu, 21/07/2016 - 17:01

There are many talented designers with the ability to create a fabulous, responsive, web design worthy of the term “screen candy.” But looks aren’t everything and website design is not just art. When a website fails to engage the visitor, it’s often due to the designer’s failure to plan strategically.

Catégories: Elsewhere

Drupalize.Me: Why Is Learning Drupal Hard?

jeu, 21/07/2016 - 15:00

When it comes to learning Drupal I have a theory that there's an inverse relationship between the scope of knowledge that you need to understand during each phase of the learning process, and the density of available resources that can teach it to you. Accepting this, and understanding how to get through the dip, is an important part of learning Drupal.

Catégories: Elsewhere

FFW Agency: The Power of Extending Twig Templates

jeu, 21/07/2016 - 09:06
The Power of Extending Twig Templates David Hernandez Thu, 07/21/2016 - 07:06

Extending in Twig is a method by which one template can inherit content from another template, while still being able to override parts of that content. This relationship is easy to imagine if you are familiar with Drupal’s default system of template inheritance.

A theme can have multiple page templates, many node templates, even more field templates, and a plethora of block and Views template. And it is common for those templates to largely be identical, save for a snippet of markup or some logic. The advantage in extending templates is reducing this duplication, thereby simplifying architecture and easing maintenance.

Let’s say, for example, you want to change the template for a specific block, adding a wrapper div around the main content area. This might be done by copying the standard block template and giving it a name specific to your block.

Classy’s block.html.twig template
{%
  set classes = [
    'block',
    'block-' ~ configuration.provider|clean_class,
    'block-' ~ plugin_id|clean_class,
  ]
%}
<div{{ attributes.addClass(classes) }}>
  {{ title_prefix }}
  {% if label %}
    <h2{{ title_attributes }}>{{ label }}</h2>
  {% endif %}
  {{ title_suffix }}
  {% block content %}
    {{ content }}
  {% endblock %}
</div>

Copied to block--my-special-block.html.twig
{%
  set classes = [
    'block',
    'block-' ~ configuration.provider|clean_class,
    'block-' ~ plugin_id|clean_class,
  ]
%}
<div{{ attributes.addClass(classes) }}>
  {{ title_prefix }}
  {% if label %}
    <h2{{ title_attributes }}>{{ label }}</h2>
  {% endif %}
  {{ title_suffix }}
  {% block content %}
    <div class=”content-wrapper”>{{ content }}</div>
  {% endblock %}
</div>

This accomplishes your goal. You have a template specific to this particular block, and a wrapper div just where you need it. Following the same method, and with a complex site, you can end up with lots of different block templates (or node templates, or field templates, or … you get the idea.)

But, now you have a different problem. The majority of the template is duplicated. All the CSS classes, the outer wrapper, the markup for the block title, etc. If any of that needs to be changed, like changing all block titles from H2s to H3s, you have to update every single one of those templates.

Even if this happens infrequently enough not to be considered time consuming, it is still prone to errors. You might make a mistake in one template, miss one that needs changing, or even change one that should not be changed.

This is where {% extends %} comes in

Extending templates allows you to reference the original template, and only override the parts that are unique to the child template.

In the block example, we can create a block--my-special-block.html.twig template with this content:

{% extends "block.html.twig" %}
{% block content %}
  <div class=”content-wrapper”>{{ parent() }}</div>
{% endblock %}

That’s it. That is the whole template. Twig uses the original block.html.twig template as the main template, and only uses what we override in the more specific block--my-special-block.html.twig template.

The parent() function simply returns all of the content within the {% block %} tags in the original template. This saves us from having to duplicate that content; keeping the template simple, and future proofing it. If any of that content changes in the original template, we don’t have to update the block--my-special-block.html.twig template.

In this example, the content in the original template is fairly simple, only printing the content variable, but imagine if there was a large amount of multiline html and Twig code wrapped in those block tags.

Twig blocks, not Drupal blocks!

This overriding is done by using Twig blocks. (Terminology is fun!) The Twig block is what you see identified by the {% block %} and {% endblock %} tags. The word "content" is the identifier for the block. You can have multiple blocks in a single template.

In the block--my-special-block.html.twig template file, we can do anything we want inside the block tags. Twig will replace the original templates “block” with the one in block--my-special-block.html.twig.

What else?

Well, you have access to pretty much everything in the main template, except the printed markup. So, for example, you can modify the variables it uses.

{% extends "block.html.twig" %}
{% set attributes = attributes.addClass(‘super-special’) %}

This template will add a CSS class called "super-special" to the attributes printed in the outer wrapper of the original block template. The alternative would be to copy the content of the entire block.html.twig template just to add this class to the ‘classes’ array at the top of the file.

You can also just set a variable that will be used by the original template.

{% extends "block.html.twig" %}
{% set foo = 'yellow' %}

Imagine a series of variant field or content type templates that set variables used by the original template for classes, determining structure, etc.

You can even add Twig logic.

{% extends "block.html.twig" %}
{% block content %}
  {% if foo %}
    <div class=”content-wrapper”>{{ parent() }}</div>
  {% else %}
    {{ parent() }}
  {% endif %}
{% endblock %}

Pretty much anything you still might want to do with Twig, inside or outside of the block tags, you can still do.

Things to note

Before you jump right in, and bang your head against a wall trying to figure out why something isn’t working, there a few things to know.

  • The {% extends %} line needs to be at the top of the file.
  • When overriding markup, you can only change what is within block tags in the original template. So add {% block %} tags around anything you might want to modify.
  • You cannot print additional things outside of the overriding block tags. You will have an extends line. You can set variables, add comments, add logic, and override blocks. You cannot put other pieces of markup in the template. Only markup that is inside a block.
  • If Drupal does not extend the correct template, based on what you expect from template inheritance, you may have to explicitly state the template you want.
    Example: {% extends "@classy/block/block.html.twig" %}
Additional Resources Tagged with Comments
Catégories: Elsewhere

GVSO Blog: [GSoC 2016: Social API] Week 8: Social Post implementer

mer, 20/07/2016 - 22:36
[GSoC 2016: Social API] Week 8: Social Post implementer

Week 8 is over and we are just one month away from Google Summer of Code final evaluation. I mentioned in my last weekly summary that I would work on documentation about implementing a Social Auth integration.

gvso Wed, 07/20/2016 - 16:36 Tags Drupal Drupal Planet GSoC 2016
Catégories: Elsewhere

Third & Grove: Drupal GovCon: Day 1 Recap

mer, 20/07/2016 - 20:03
Drupal GovCon: Day 1 Recap abby Wed, 07/20/2016 - 14:03
Catégories: Elsewhere

Into my Galaxy: GSoC’ 16: Port Search Configuration module; coding week #8

mer, 20/07/2016 - 19:50

I have been porting Search Configuration module from Drupal 7 to 8 as part of this year’ s Google Summer of Code (GSoC). This summer program is an opportunity for university students to work on projects connected with open source organisation. I have been really lucky to be a part of this initiative. I could explore deep of more technologies, version control systems as part of my project in Drupal. This gives young students a platform where they are assigned mentors who are experts and experienced in various software.

Last week, I could learn some of the Drupal concepts as part of this module port. So, let me begin with the Drupal 7 property. The t function translates a string to the current language or to a given language. This makes the strings used in Drupal translatable. This generally takes up the format:

t($string, array $args = array(), array $options = array());

Here, $string is the string containing the English text to get translated.

$args: An associative array of replacements to make after translation.

$options: An optional associative array of additional options, with the following elements: lang code and context.

This t function has got some alteration in the Drupal 8. It has been replaced by the $this->t() by making use of \Drupal\Core\StringTranslation\StringTranslationTrait. 

 The translatable markup returns a string as a result of this process.

Another important aspect which I dealt was the roles. This is an important feature  for any module as it  deals with the security constraints of the module. Roles are often manipulated to grant certain permissions. What we have to do is that, initially, load the particular role to be manipulated and then provide the permission which is to be granted.

$role = Role::load('access page.'); $role->grantPermission('access comments'); $role->save();

These role functions help us to load the roles and manipulate the permissions assigned to it quite easily. Thus, turns out to be really helpful in dealing with permissions.

I have been also dealing with writing the simple test for my module. In one of my previous blog posts, I have introduced the PHP unit testing.  The simple test tests the web oriented functionality of the module. It needs a good understanding of the behaviour of the module to write an effective test. Tests are often really important to identify the flaws of a functionality and to correct it accordingly. I will be writing the simple tests for my module in the coming days. I will be sharing you the concept of this mode of testing in my next blog post.

Stay tuned for further developments on this blog post.

 

 

 


Catégories: Elsewhere

Drupal core announcements: Drupal 8.2.0 will be released October 5; beta begins week of August 3

mer, 20/07/2016 - 18:23

Drupal 8.2.0, the next planned minor release of Drupal 8, is scheduled for Wednesday, October 5, 2016. Minor releases include new features, usability improvements, and backwards-compatible API improvements. Here's what this means for core patches.

Drupal 8.2.0-beta1 will be released the week of August 3
  • In preparation for the minor release, Drupal 8.2.x will enter a beta phase the week of August 3.
  • Developers and site owners can begin testing the beta.
  • The 8.3.x branch of core will be created, and future feature and API additions will be targeted against that branch instead of 8.2.x.
  • All outstanding issues filed against 8.2.x will be automatically migrated to 8.3.x once it is opened.
  • During the beta phase, core issues will be committed according to the following policy:
    1. Most issues that are allowed for patch releases will be committed to all supported minor branches (8.1.x, 8.2.x, and 8.3.x) for the duration of the beta. Drupal 8.0.x is not supported anymore and changes are not made to that branch.
    2. Issues specific to added 8.2.x functionality, or disruptive changes that have a positive impact outweighing their disruption, will be committed to both 8.2.x and 8.3.x. (Such issues can be moved back to the 8.2.x branch after the automatic migration.)
    3. Most issues that are only allowed in minor releases will be committed to 8.3.x only.
Drupal 8.2.0-rc1 will be released September 7
  • The release candidate phase for the minor release begins on September 7, and starting on that date, the 8.2.x branch will be subject to release candidate restrictions, with only critical fixes and certain other limited changes allowed.
  • September 7 is also the final scheduled patch release window for 8.1.x, and it will not receive further development or support after that date aside from its final security release window on September 21.
  • All outstanding issues filed against 8.1.x will be automatically migrated to 8.2.x after the final 8.1.x patch release. Bug reports after September 7 should be targeted against the 8.2.x branch.
  • Minor versions may include changes to user interfaces, translatable strings, themes, internal APIs like render arrays and controllers, etc. (See the Drupal 8 backwards compatibility and internal API policy for details.) Developers and site owners should test the release candidate to prepare for these changes.
  • 8.3.x will remain open for new development during the 8.2.x release candidate phase.

See the Drupal core release cycle overview, Allowed changes during the Drupal 8 release cycle, and Drupal 8 backwards compatibility and internal API policy for more information.

As a reminder, we have until the start of the beta to add great new features to Drupal 8.2.x. Stabilizing experimental modules (such as Migrate and BigPipe), new features for workflows, and usability and bugfixes are all priorities for 8.2.0. Help with these feature requests and initiatives now for a great Drupal 8.2.0!

Catégories: Elsewhere

ThinkShout: Drupal 8 Routing Tricks for Better Admin URLs

mer, 20/07/2016 - 16:30

We recently launched a new case tracker for foster ed youth designed to improve their educational outcomes in partnership with The National Center for Youth Law (NCYL). The web application replaces their existing platform, Goal Book, which lacked the flexibility they needed to meet their requirements. A web application differs from a website in that a website primarily provides content where a web application primarily provides tools.

The project presented us with an opportunity to do extensive custom development with our favorite new platform, Drupal 8. D8’s many developer experience improvements, including standardized object-oriented development methods, allowed us to meet NCYL’s requirements efficiently and with a level of quality that would have been more difficult on Drupal 7. In addition, we were able to accelerate the release of RedHen CRM on Drupal 8, which lives at the heart of the application managing all of the contacts, organizations, and relationships.

To enhance the utility of the application, we made an early decision to customize every URL a user would interact with. As most of the functionality would revolve around nodes, we wanted to make sure we avoided URLs like /node/256/edit that don’t give the user any indication of which part of the application they’re using.

Implementation

If you wanted to customize URLs in Drupal 7, you could use the Pathauto module. You can still do that in Drupal 8, but D8’s routing system can be coaxed into doing something similar. It works on admin pages, too, which was perfect for NCYL’s needs.

Overriding Existing Node Paths

As an example, let’s say you have a node type specifically for storing information about schools: a School Node. The standard admin path for adding a School Node would be something like this:

/node/add/school

But, add a custom module with route configuration and you can have this:

/school/add

For simplicity, we’ll call our module school.module. The directory structure looks like this:

modules/ school/ school.module school.routing.yml

The route configuration sits inside school.routing.yml and looks like this:

school.add: path: '/school/add' defaults: _controller: '\Drupal\node\Controller\NodeController::add' _title: 'Add School' node_type: 'school' requirements: _node_add_access: 'node:school'

Line by line:

school.add:

This is the name of the route. Route names should be unique and usually start with the name of your module.

path: '/school/add'

The path the route points to. This is the part that comes after your site’s base URL.

_controller: '\Drupal\node\Controller\NodeController::add'

This tells the route to use the NodeController, provided by the Node module. No need for a custom controller here.

_title: 'Add School'

This sets the page title of the node add form.

_node_add_access: 'node:school'

This is an access handler that ensures the user has permission to add a node of type “school.”

Providing a custom path to edit School Nodes is even easier:

school.edit: path: '/school/{node}/edit' defaults: _entity_form: 'node.edit' requirements: node: \d+ _entity_access: 'node.update'

We no longer need to tell the route which controller to use or what type of node we’re using. Drupal 8’s Entity API figures it out using the node ID passed in the URL.

Line by line again:

path: '/school/{node}/edit'

The path now contains a placeholder, {node}, which represents the node ID in the URL.

_entity_form: 'node.edit'

The form we want to use to edit the node.

node: \d+

Some validation to ensure the URL contains the right data type for a node ID. By specifying the regular expression pattern \d+, we are telling Drupal to only use this route when {node} is one or more digits. The route will match a URL like /school/32/edit, but will not match /school/lincoln-high/edit.

_entity_access: 'node.update'

An access handler, ensuring the user has permission to update this node. No need to specify the node type, as we did when adding a node.

Finally, a route for viewing the node:

school.view: path: '/school/{node}' defaults: _controller: '\Drupal\node\Controller\NodeViewController::view' requirements: node: \d+ _entity_access: 'node.view'

Very similar to the node edit route, just with a different path and controller.

For a more thorough explanation of routes and route options not covered here, check out the official docs.

Custom Controllers

What if you want to provide a custom controller for adding a node and still take advantage of Drupal’s permissions system? Routes can do that, too.

Let’s introduce a Teacher Node and an accompanying module.

modules/ school/ teacher/ src/ Controller/ TeacherController.php teacher.module teacher.routing.yml

teacher.routing.yml looks like this:

teacher.add: path: '/teacher/add' defaults: _controller: '\Drupal\teacher\Controller\TeacherController::addTeacher' _title: 'Add Teacher' node_type: 'teacher' requirements: _node_add_access: 'node:teacher'

Very similar to the route we used to add School Nodes, but with a custom controller.

TeacherController.php looks like this:

<?php namespace Drupal\teacher\Controller; use Drupal\node\NodeTypeInterface; class TeacherController extends ControllerBase { public function addTeacher(NodeTypeInterface $node_type) { } }

The addTeacher function is where you would add your custom code for adding Teacher Nodes.

That’s how you can use core Drupal 8 functionality to make your Drupal admin pages a little more user friendly.

Catégories: Elsewhere

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

mer, 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
Catégories: Elsewhere

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

mer, 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!

Catégories: Elsewhere

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

mer, 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
Catégories: Elsewhere

DrupalCon News: DrupalCon Dublin Sessions Announced

mer, 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!

Catégories: Elsewhere

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

mar, 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.  

Catégories: Elsewhere

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

mar, 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
Catégories: Elsewhere

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

mar, 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
Catégories: Elsewhere

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

mar, 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
Catégories: Elsewhere

Pages