28 Sep 2016

feedDrupal.org aggregator

erdfisch: Drupalcon Dublin: Come to the island and get off the island

Drupalcon Dublin: Come to the island and get off the island

Single image:
The beach around the corner from our Dublin apartment

28.09.2016 Michael Lenahan

Body:

Getting off the island

As a back-end developer, one of the surprising and fun things about this Drupalcon is how much I have learned about front-end and theming in Drupal. This has been my way of "getting off the island" and learning about things a little outside my normal comfort-zone.

The kitchen table track at Drupalcon Dublin

There were two things that were the impetus for this. Firstly, I came to Dublin with Pascal https://www.drupal.org/u/hydra who works with us at erdfisch as our front-end development expert. I spent the weekend learning (and documenting) our approach to rendering content in flexible ways to achieve more sophisticated output of content than Drupal usually allows. In a nutshell, this allows us to provide very sophisticated front-end design.

The module driving this is called "seem". We were working on it this morning at the kitchen table.

Exam time

The second thing that happened was that Stefan https://www.drupal.org/u/sanduhrs and I decided to jump in and take the Drupal 8 Acquia Certified Developer Exams. Stefan has passed the two Drupal 8 Exams this week (Acquia Certified Drupal 8 Site Builder and Acquia Certified Developer Drupal 8 Front-end Specialist).

I passed the Acquia Certified Drupal 8 Site Builder and am taking the Front-End Specialist exam tomorrow morning. Wish me luck!

All this has, of course, given me lots of motivation to go to sessions related to front-end and theming this Drupalcon. More to come on that in another blog post.

Schlagworte/Tags:
planet drupalcon dublin

28 Sep 2016 9:02pm GMT

OSTraining: New Drupal 8 Ideas in Dries' Dublin Keynote

DrupalCon Dublin Keynote

This week is DrupalCon Dublin. And as always, Dries gave the keynote address on the first morning of the event.

This year's keynote was broken into two sections: "Drupal 8 Update" and "The Why".

In "Drupal 8 Update", Dries talks about the technical side of Drupal. From minute 27 to minute 42, Dries talks about what's new in Drupal 8.2, which arrives on October 5th. We've covered those new features in previous posts. Then, from minute 42 to 48, Dries discusses features may arrive in future Drupal versions. If you're short on time, watch those 6 minutes. Scroll down in this post, and we'll cover those 6 minutes in detail.

In "The Why", starting at minute 40, there's a much broader focus on the larger purpose of Drupal. This section of personal anecdotes and stories of Drupal in action.

28 Sep 2016 4:01pm GMT

Deeson: The DrupalCon Dublin 2016 Wrap-Up - A View from the Floor

DrupalCon 2016

As a former tech journalist I am well experienced in attending conferences all around the world, so I was very excited to attend DrupalCon Dublin on the behalf of Deeson.

With DrupalCon, it was a great opportunity to learn more about Drupal straight from the mouths of a thriving community. But with the 'Future of Work' approach being one of a number of reasons I decided to join the company, it was a great opportunity to share our message and the way people can thrive at Deeson with its openness, autonomy, flexible working, paid sabbaticals and paid time to contribute to the community.

DrupalCon Europe was very different to the conferences that I've experienced in the past in that instead of the slickness of a warm-up act with sales patter and a costly presentation, I was presented with fun and games from the Drupal community, including a singalong, viking claps, and some Irish dancing. Already I could tell this would be different experience to the tech events I've been used to.

An early morning Irish jig to get us ready for the #DrupalCon Dublin sessions today. #morningexercise pic.twitter.com/r0gQWlCOUQ

- Asavin Wattanajantra (@Asavin) September 27, 2016

This was great preparation for the day, and the first presentation I saw was a powerful keynote by the founder and lead developer of Drupal Dries Buyteart about how wide and far the community stretched, and how it gave opportunities in terms of a career around the world.

Below is a video of the keynote, and is certainly inspiring for anybody thinking of getting into Drupal, whether it's as a developer or non-technical person like me as a marketer, a project manager, or business developer.

This is how the rest of the week will shape up.

28 Sep 2016 11:33am GMT

Amazee Labs: A day at DrupalCon with Sebastian

A day at DrupalCon with Sebastian

It is on! DrupalCon Dublin has officially started and it's going to be epic.

Sebastian Siemssen Wed, 09/28/2016 - 12:36

The second day at DrupalCon started early with the in-famous prenote. After a long first day setting up our gorgeous booth, exploring the convention center, meeting new and old friends, a lot of hugs and a fabulous finish at the Amazee Storyteller and Gravedigger bus tour the early timeslot of the prenote was a challenge for many. If you missed the prenote, you can watch the recording on Youtube. Look out for the Pot of Gold!

The room was packed for the Pre- and Keynote.

As usual, the Prenote was followed by the Keynote aka the "Driesnote", in which Dries Buytaert, the founder of Drupal, gave an overview of the state of Drupal and its outlook for the future. You can watch the Keynote on Youtube too.

Dries giving the Keynote.

For me, the rest of the morning was packed with interesting discussions and code sprints around GraphQL for Drupal. If you are interested to hear more about that or get involved, find me at our booth or in the sprints room.

Sprinting with the Drupal community.

I fueled my sugar addiction with an unhealthy amount of Amazee lollipops at our gorgeous booth during the breaks. If you want one too, come by our booth and find one of our lollipop dealers.

In the afternoon the sprinting continued and I got to show off our Microsoft HoloLens to a couple of people.

Showing off the HoloLens to our friends.

If you are interested and want to give it a try, come by our booth. It's fun, I promise!

28 Sep 2016 10:36am GMT

MD Systems blog: We are striving to invest 20% of every project’s value back into the community

It is probably no secret that we are one of the bigger contributors to Drupal (definitely the biggest when company size is taken into consideration). Contribution is part of our daily routine. Every time when we run into a problem that can be resolved in a general/community way we try to do that. Our developers are active in the issue queues on a daily basis. Working in the drupal.org issue queue is as common as checking new messages on our company's Mattermost channels.

28 Sep 2016 8:48am GMT

Dries Buytaert: The transformation of Drupal 8 for continuous innovation

In the past, after every major release of Drupal, most innovation would shift to two areas: (1) contributed modules for the current release, and (2) core development work on the next major release of Drupal. This innovation model was the direct result of several long-standing policies, including our culture of breaking backward compatibility between major releases.

In many ways, this approach served us really well. It put strong emphasis on big architectural changes, for a cleaner, more modern, and more flexible codebase. The downsides were lengthy release cycles, a costly upgrade path, and low incentive for core contributors (as it could take years for their contribution to be available in production). Drupal 8's development was a great example of this; the architectural changes in Drupal 8 really propelled Drupal's codebase to be more modern and flexible, but also came at the cost of four and a half years of development and a complex upgrade path.

As Drupal grows - in lines of code, number of contributed modules, and market adoption - it becomes harder and harder to rely purely on backward compatibility breaks for innovation. As a result, we decided to evolve our philosophy starting after the release of Drupal 8.

The only way to stay competitive is to have the best product and to help people adopt it more seamlessly. This means that we have to continue to be able to reinvent ourselves, but that we need to make the resulting changes less scary and easier to absorb. We decided that we wanted more frequent releases of Drupal, with new features, API additions, and an easy upgrade path.

To achieve these goals, we adopted three new practices:

  1. Semantic versioning: a major.minor.patch versioning scheme that allows us to add significant, backwards-compatible improvements in minor releases like Drupal 8.1.0 and 8.2.0.
  2. Scheduled releases: new minor releases are timed twice a year for predictability. To ensure quality, each of these minor releases gets its own beta releases and release candidates with strict guidelines on allowed changes.
  3. Experimental modules in core: optional alpha-stability modules shipped with the core package, which allow us to distribute new functionality, gather feedback, and iterate faster on the modules' planned path to stability.

Now that Drupal 8 has been released for about 10 months and Drupal 8.2 is scheduled to be released next week, we can look back at how this new process worked. Drupal 8.1 introduced two new experimental modules (the BigPipe module and a user interface for data migration), various API additions, and usability improvements like spell checking in CKEditor. Drupal 8.2 further stabilizes the migration system and introduces numerous experimental alpha features, including significant usability improvements (i.e. block placement and block configuration), date range support, and advanced content moderation - among a long list of other stable and experimental improvements.

It's clear that these regular feature updates help us innovate faster - we can now add new capabilities to Drupal that previously would have required a new major version. With experimental modules, we can get features in users' hands early, get feedback quickly, and validate that we are implementing the right things. And with the scheduled release cycle, we can deliver these improvements more frequently and more predictably. In aggregate, this enables us to innovate continuously; we can bring more value to our users in less time in a sustainable manner, and we can engage more developers to contribute to core.

It is exciting to see how Drupal 8 transformed our capabilities to continually innovate with core, and I'm looking forward to seeing what we accomplish next! It also raises questions about what this means for Drupal 9 - I'll cover that in a future blog post.

28 Sep 2016 8:46am GMT

Drupal core announcements: Chris McCafferty (cilefen) as provisional committer

With Drupal 8 now adding new features on a regular release cycle, the Drupal 8 committers identified the need for additional release management. Today I am announcing that Chris McCafferty (cilefen) has accepted my invitation to be provisional Drupal 8 committer.

Chris is a United States-based web programmer at the Institute for Advanced Study who has worked with Drupal and the Symfony framework for over four years. He is also a core mentoring coordinator who has put in uncounted hours mentoring contributors in person and on IRC and has lead major issue triage sprints at DrupalCons in Los Angeles and New Orleans. In addition, Chris spreads the word about Drupal by mentoring at other events, such as OpenHatch Princeton.

Chris makes significant contributions to a wide variety of Drupal core issues. If you have worked in the issue queue in the last few years, you have probably interacted with Chris on topics ranging from front-end to the testing frameworks. He has the attitude and skills needed to foster collaboration among the talented contributors in the Drupal community and to continue releasing Drupal on time. Please join me in welcoming Chris.

28 Sep 2016 5:46am GMT

PreviousNext: Why project managers need to lose control

Being accountable for the planning, execution, and delivery of a project is demanding. Managing people, facilitating communication, resolving conflict, and mitigating risk are prerequisites to completing on schedule, and within an agreed budget. Add to this the often unpredictable nature of these factors and it's little wonder that project managers feel a great burden of responsibility.

28 Sep 2016 1:39am GMT

27 Sep 2016

feedDrupal.org aggregator

Torchbox: Highlights from Day 1 at DrupalCon Dublin

27 Sep 2016 11:00pm GMT

KnackForge: Drupal form's #tree option

knackforge blog
Profile picture for user vannia

Drupal form's #tree option

by - Sep 27, 2016 0 Comments

Tag(s)

There may be a need to name the form elements in an array structure how the form is built. You can see this in Ubercart checkout pane form's input elements. This is very useful when one has a large multi-part form which can be grouped easily by their POST content's array format.

Eg: panes[delivery][delivery_first_name]

A simple flag on you $form construct array will do the trick. It's the #tree option. For whichever elements you set this #tree option, the element's children will be named with full reference to its parents.

Continue reading →

27 Sep 2016 5:08pm GMT

Nuvole: Configuration Management: Theory and Practice

Our presentation at DrupalCon Dublin 2016

Developers often want to use Configuration Management outside its intended use case. New workflows and practices have to be established.

We've just presented a gallery of problems and solutions at DrupalCon Dublin 2016.

The room was packed, and many people were denied admission for security reasons. For them, and for those who didn't manage to come to this DrupalCon, we are making the full presentation available here:

Tags:
Drupal Planet
Drupal 8
DrupalCon
Attachments:
Configuration-Management-Theory-and-Practice.pdf

27 Sep 2016 4:23pm GMT

Chromatic: Drupal Code Standards: The t() Function

This is the fifth post in a series about coding standards. In this post we'll talk about how to use translation functions in both Drupal 7 and 8. This is so essential that it deserves its own post!

Other posts in this series:

  1. Drupal Code Standards: What Are They?
  2. Drupal Code Standards: How Do We Implement Them?
  3. Drupal Code Standards: Formatting
  4. Drupal Code Standards: Documentation
  5. Drupal Code Standards: The t() function
  6. Drupal Code Standards: Object Oriented Coding & Drupal 8
  7. Drupal Code Standards: Twig in Drupal 8

What is the t() function?

The t() function allows for localization and translates a given string to a given language at run-time. When coding, you wrap your user-facing strings in this function so that they can be translated.

When do I use it?

In just about every user-facing string. This ensures that your site can be localized! When in doubt, translate everything. You might be thinking "oh, this string will never need to be translated," but 2 years later, when you're trying to find this string that's showing up untranslated on the site, and your shareholders want it changed, you'll be much happier if it's already ready to translate. I may be speaking from experience here.

What does it do?

Firstly, t() translates text at runtime if you have more than one language enabled. Depending on which placeholder you use, it runs different sanitization functions.

The t() function takes 3 parameters, 2 of which are optional. The first is the string to be translated, the second is the array of replacements, if any. The third is an array of options. From Drupal.org:

$options: An associative array of additional options, with the following elements: * 'langcode' (defaults to the current language): The language code to translate to a language other than what is used to display the page. * 'context' (defaults to the empty context): A string giving the context that the source string belongs to.

String context (or translation context) is a way to organize translations when words have 1 to many translations. From the handbook page:

What is string context?

When translating Drupal's user interface to other languages, each original (English) string can have only one translation. This is a problem when one English word has several meanings, like "Order", which can mean the order of elements in a list, to order something in a shop, or an order someone has placed in a shop. For many languages, the string "Order" needs a different translation for each of these meanings.

You can read more about string context here.

Using Placeholders

Placeholders come from the format_string function, which is called by t().

The most common placeholder is probably @variable. This placeholder runs check_plain() on the text before replacing it. Never pass a variable through t() directly - only string literals. The short explanation for this is that the string to be translated needs to be available at runtime, and a variable may not be available and may change its value. You can find an in-depth explanation here.

You use a placeholder to insert a value into the translated text, like in this example from the Advanced Forum contrib module:

$block->title = t(
  'Most active poster in @forum', array('@forum' => $forum->name)
);

You may also use %variable, which runs drupal_placeholder() on the text, which both escapes the text and formats it as emphasized text.

In Drupal 7, !variable inserts your value exactly as is, without running any sanitization functions, so you would never want to use this on user-entered text, and only on text that has already been properly escaped.

In Drupal 8, !variable is deprecated, replaced by :variable.

In Drupal 8, :variable is escaped with \Drupal\Component\Utility\Html::escape() and filtered for dangerous protocols using UrlHelper::stripDangerousProtocols().

So now you might be wondering what to do in Drupal 8 if you do not want to escape your text at all, now that the !variable placeholder is gone. There is a way! In the placeholderFormat() function, there's a default case. Let's take a look at the code:

default:
        // We do not trigger an error for placeholder that start with an
        // alphabetic character.
        if (!ctype_alpha($key[0])) {
          // We trigger an error as we may want to introduce new placeholders
          // in the future without breaking backward compatibility.
          trigger_error('Invalid placeholder (' . $key . ') in string: ' . $string, E_USER_ERROR);
        }
        break;
    }

So if we use a placeholder that starts with an alphabetic character, it won't trigger an error, but it also won't trigger any actions. You can use any alphabetic character(s) you like for your dummy placeholder. Something easily identifiable, like TT is a good idea - and comment your code!

When don't I use it?

In Drupal 7, there are some instances where t() is not available.

During the installation phase, t() isn't available, so you must use get_t(). You can do something like this:

$t = get_t();
$t('my string');

Translation is also not used inside of hook_schema() or hook_menu().

In Drupal 8, t() is always available, so you can always use it.

t() and links

There are a lot of times that you may want to translate the text in a link - there are lots of ways to do this, and most of them aren't the best. Here are some bad examples, and a good (and simple!) one.

Bad:


$do_not_do_this = t('Do not ')."" . t('link ') . ""  .t('to something like this.');


$bad = t('This is not a good way to make a @link.', array('@link' => ''. t('link') .'')); 


$dreadful = t('This is a dreadful way to make a link pointing to the Drupal API t() documentation.'); 


$awful = t('This may seem good, but it's an awful way to link to this @doc.', array('@doc => l(t('documentation'), 'https://api.drupal.org'));

Good:

$good = t('Read about the t() function here.', array('@api' => 'https://api.drupal.org'));

Here's an example from Drupal 8 Core, in the function install_check_translations() in install.core.inc:

// If the translations directory is not readable, throw an error.
    if (!$readable) {
      $requirements['translations directory readable'] = array(
        'title'       => t('Translations directory'),
        'value'       => t('The translations directory is not readable.'),
        'severity'    => REQUIREMENT_ERROR,
        'description' => t('The installer requires read permissions to %translations_directory at all times. The webhosting issues documentation section offers help on this and other topics.', array('%translations_directory' => $translations_directory, ':handbook_url' => 'https://www.drupal.org/server-permissions')),
      );
    }

In this code you can see that the tags are inside the t() function, and the url is escaped using the :variable placeholder.

It's okay to put a little html in your t() function to simplify like this. The element can easily be moved around if the translation requires it, without needing to know any code other than which word is being linked. Our next section will talk more about keeping your text translatable.

Translation Best Practices

Writing your code and content to be translatable isn't just a best practice, it may very well be used to actually translate your site, so sometimes you need to think from the point of view of a translator. Try not to abstract out pieces of content too much. Here's an example. In English, you may have a blog title "Bob's Homepage." You could want to abstract that into the following:


$username . "'s " . t('Homepage.');

What's the problem here? In other languages, this phrase may be re-arranged. For example, in French or Spanish, it would be "Homepage de Bob." The above example would require a translator to change code. We don't want that. So we write this:

t('@user's Homepage.', array('@username' => 'Bob'));

Now, this string can easily be changed to:

t('Homepage de @user.', array('@username' => 'Bob'));

Concatenation Dos and Don'ts

In the example in the previous section, we showed where concatenating a translated string with another string can make trouble. There are some other things you want to avoid.

Don't concatenate strings within t(). For example, don't do this:


t('Don't try to join' . ' ' . @num . ' ' . 'strings.', array('@num' => 'multiple'));

Even if you think you have to, there is a better way.

And don't concatenate t() strings and variables - you don't need to!

Don't do this:


t('This is a complicated way to join ') . $mystring . t(' and translated strings');

Additionally, the above would give you a codesniffer error because you should not have leading or trailing whitespace in a translatable string.

Do this:

t('This is a simple way to join @mystring and translated strings', array('@mystring' => 'whatever my string is'));

This is how the t() function is designed to be used! Going around it defeats the purpose of using it at all.

Drupal 8 & Twig

In Drupal 8, the essential function and its use are the same. Wrap text in your module code in t(''), with the same optional placeholder and options arrays. As noted in the placeholders section, !variable has been deprecated and replaced with :variable.

With Drupal 8, we have the introduction of the Twig templating engine, and with that, new ways format our text for translation.

The simplest way is to pipe your text through |t. Here's an example from the Devel contrib module:

In the above code, we can see the text in the table headers piped into the translation function, just as it would be passed through t() in Drupal 7. You can also use |trans interchangeably with |t. You can use a {% trans %} block to translate a larger chunk of text or use placeholders. These blocks can also handle logic for plurals. Here's an example from Drupal 8 Core:

{{ view.label }}


{% if displays %} {% trans %} Display {% plural displays %} Displays {% endtrans %}: {{ displays|safe_join(', ') }} {% else %} {{ 'None'|t }} {% endif %}

Here we can see that the template appropriately shows the translated text for "Display" or the plural, "Displays."

From Drupal.org:

Values are escaped by default. The 'passthrough' filter can be used to skip escaping. The 'placeholder' filter can be used to form a placeholder. The default behavior is equivalent to @ in t(), while 'passthrough' matches ! and 'placeholder' matches %.

This comes from Twig, and is not yet commonly used in Drupal, but its usage with placeholders is similar to t(). Here's an example from Drupal 8 Core:

 {% set includes = includes|join(', ') %}
  {% if disabled %}
    {{ 'Includes:'|t }}
    

  {% else %}
    {% trans %}
      Includes: {{ includes|placeholder }}
    {% endtrans %}
  {% endif %}

In the above code, we can see the use of the placeholder in Twig. The set lines set the placeholders to be used later in the code. The |placeholder filter indicates that a replacement is to be made.

Wrapping Up

This post has a lot of what not to do, but you'll run into a lot of creatively incorrect code when it comes to translation, and now you'll know it when you see it. Simple is best. Remember that this function exists to give translators a list of strings to translate, and you'll be in the right frame of mind when assembling these strings to keep them flexible and translatable!

Have some questions/comments/concerns? Experience you'd like to share? Talk to us on Twitter: @ChromaticHQ!

Keep an eye out for our next post in our Drupal Code Standards series, on Object Oriented programming in Drupal 8!

{{ 'Name'|t }} {{ 'Path'|t }} {{ 'Info file'|t }}

27 Sep 2016 2:16pm GMT

Acquia Developer Center Blog: How to Get Behind the Great Firewall of China

photo of earth

Whether you're outside China and trying to get in, or inside China and trying to get out, a well-known barrier sits between the Chinese internal network and the wider internet. The Great Firewall of China (防火长城) acts as a giant filter between the two networks, restricting access to external sites considered unsavory by the Chinese government.

Tags:
acquia drupal planet

27 Sep 2016 2:10pm GMT

Third & Grove: SRI relaunches with new site design and content architecture to drive content marketing and lead generation

SRI relaunches with new site design and content architecture to drive content marketing and lead generation tony Tue, 09/27/2016 - 08:33

27 Sep 2016 12:33pm GMT

Attiks: Drupal and polymer

Drupal and polymer

27-09 2016
Peter Droogmans

What if there were polymer elements for custom Drupal functionality

Read more

27 Sep 2016 11:42am GMT

Amazee Labs: A day at DrupalCon with Corina

A day at DrupalCon with Corina

It's this time of the year again. DrupalCon Dublin is finally here. Even though it's my fourth Con already, it's always a special event.

Corina Schmid Tue, 09/27/2016 - 12:21

The conference officially only starts Tuesday but Monday for me Monday is the more important day. It's the day of setting up our booth, making sure all things arrived and in the evening there was our Amazee Story Telling Tour around Dublin. They say a picture says more than 1000 words so here are some impressions of my DrupalCon Monday:

setting up

settin up2

booth last steps

Once the booth was set up we enjoyed the welcome reception. By the way, if you want to see the finished booth make sure you come by and meet us at the exhibit hall; we're at booth 700.

fhuby

inky

To finish off the day we ventured out on our Story Telling Tour learning about Irish Tales.

sstt

stt

sttd

tt

27 Sep 2016 10:21am GMT