Elsewhere

InternetDevels: DrupalTour: the fourth point discovered

Planet Drupal - jeu, 05/03/2015 - 11:57

DrupalTour aims at spreading the word to different cities. But the point is not just in that! We are also just having fun :)

It is already a fourth DrupalTour and this time we were heading to Khmelnitsky. Every point of destination is more and more distant from Lutsk, so the crew of Drupal van has to get up early… This time we started our journey at 7:30 AM to arrive to Khmelnitsky at 11 AM.

Read more
Catégories: Elsewhere

KnackForge: Caching in Drupal

Planet Drupal - mer, 04/03/2015 - 23:20

Drupal comprises several layers of execution and it obviously consumes pretty much time to render content from dynamic PHP code. Caching is a key technique to maximize the performance of Drupal. Before adopting a caching mechanism in Drupal, one must consider the type of site and the type of users coming to the site. Not all sites could have same caching mechanism.

 

Caching techniques could be classified at various levels depending on type of data being cached and the user affected. Drupal can have broadly two kinds of users.

  1. Anonymous Users

Catégories: Elsewhere

Phil Hands: The future arrived, again!

Planet Debian - mer, 04/03/2015 - 23:04

I am reminded by Gunnar's wonderful news that I have been very remiss in publishing my own.

Mathilda Sophie Hands, our second daughter, was delivered on the 9th of January.

Her arrival was a little more interesting than we'd have preferred (with Gunde being suddenly diagnosed with HELLP Syndrome), but all has turned out well, with Gunde bouncing back to health surprisingly quickly, and Mathilda going from very skinny to positively chubby in a few short weeks, so no harm done.

Today Mathilda produced her first on-camera smile.

It's lovely when they start smiling. It seems to signal that there's a proper little person beginning to take shape.

Catégories: Elsewhere

Lullabot: A Lullabot’s Guide to Successful Meetings

Planet Drupal - mer, 04/03/2015 - 20:00

One of the core skills of our client services team is the ability to communicate clearly, efficiently, and humanely to each other and to our clients. It’s this communication that gets us through gnarly project roadblocks and beyond the purely technical solutions. Unfortunately, this can lead to the dreaded wave of “calls”, “syncs”, “touch-bases”, and “meetings” which eat up our calendar hours.

Catégories: Elsewhere

Amazee Labs: #DCLondon 2015: “If I can do it, so can you”

Planet Drupal - mer, 04/03/2015 - 17:49
#DCLondon 2015: “If I can do it, so can you”

For the third time, Drupalcamp London warmly welcomed passionate drupalistas who flew in from all over the world to do Drupal, talk Drupal and live even more Drupal. 

The rainy Saturday of February 28th was lighten up by the inspirational talk of Dr. Sue Black who shared her story of how she went from a young single parent with 3 little children to become a computer scientist, entrepreneur and social activist. “If I can do it, so can you” is the message to all of us. Her program #techmums is one of the possible steps towards a not only more equal world, but towards a better future for all of us. Drupal and its open, strong and supportive community is one of those steps as well.

Drupal 8 is coming and you can feel the excitement within the community. I can’t help myself but I am absolutely exited every time I think about the enthusiasm and effort the community puts into battling issues and creating beautiful solutions. In the session of Schnitzel we saw an amazing improvement in terms of multilingual. This is a huge promise not only for Drupal 8 based client projects, but also for people who want to get digital and learn technology with a little help of their own native language. Anyone who speaks a second language can contribute and support this initiative

It was a pleasure to learn more about frontend tools in the talk “Rocket surgery for brain scientists” of Tom Bamford. He even talked about accessibility.

In the presentation of Josef we learned how to upgrade the Drupal 7 modules that integrate with rules to Drupal 8. This module is very important from the UX perspective as it helps us to create and send customized mails notifing your users about events of a wide variety starting with the new comment added to a blog post and ending with the emails on successful purchase in your online shot. Integrating this module into Drupal 8 Core is a great step towards more scalable and user-friendly solutions.

IPaul Rowell talked about what we call editor user experiencein his session. This is also an important topic for us at Amazee Labs as we want to be friends with our content editors. It's always great to get fresh and new input on this topic and to compare different approaches.

For myself it was a special DrupalCamp as it was the very first time that I gave a presentation with the aim of sharing our way of applying the User Centered Design approach. I was more than happy to receive interesting questions, seeing smiling people and feeling like a part of the Drupal community.

 

Seeing familiar faces, creating an impact by sharing knowledge and sprinting, is enriching and gets me even more motivated – this is what this DrupalCamp was about. We are looking forward to attend DrupalCamp London in 2016. 

Catégories: Elsewhere

Drupal core announcements: Drupal core updates for March 4th, 2015

Planet Drupal - mer, 04/03/2015 - 17:48

Since the last Drupal Core Update, the Seventh Beta of Drupal 8.0 was released (and Drush 7.0.0-alpha9 was released to coincide with it), and Mink and Goutte were added to core to support behavioural testing!

Some other highlights of the month were:

How can I help get Drupal 8 done?

See Help get Drupal 8 released! for updated information on the current state of the release and more information on how you can help.

We're also looking for more contributors to help compile these posts. Contact mparker17 if you'd like to help!

Drupal 8 In Real Life
  • DrupalSouth Melbourne is happening March 5—7 at the Melbourne Convention and Exhibition Centre in Melbourne, Victoria, Australia, featuring sprinting and lots of speakers.
  • DrupalCamp Hyderabad will be on March 7th and 8th in Hyderabad, Telangana, India.
  • DrupalCamp China will be held on March 14th in the famous Pudong district of Shanghai, China, featuring a session on open-source e-commerce by Ryan Szrama, VP of Community Development at Commerce Guys.
  • European Drupal Days will be March 19—21 in Milan, Italy. The 19th will have sessions on Drupal 8 theming, the future of commerce in Drupal 8, #d8rules; the 20th will have workshops on continuous integration, Symfony, dependency injection and theming, and the 21st will be lots of sprinting!
  • MidCamp is coming up on March 19—22 at the University of Illinois in Chicago, Illinois, USA. There will be training, speakers, and lots of sprinting! Tickets are still available, but hurry before they're sold out!

Also, don't forget to vote for your Drupal Association Community Director — voting is open March 9th through 20th!

Whew! That's a wrap!

Do you follow Drupal Planet with devotion, or keep a close eye on the Drupal event calendar, or git pull origin 8.0.x every morning without fail before your coffee? We're looking for more contributors to help compile these posts. You could either take a few hours once every six weeks or so to put together a whole post, or help with one section more regularly. If you'd like to volunteer for helping to draft these posts, please follow the steps here!

Catégories: Elsewhere

Amazee Labs: Drupal Elections: The Drupal Association Board and it’s responsibilities

Planet Drupal - mer, 04/03/2015 - 17:18
Drupal Elections: The Drupal Association Board and it’s responsibilities

Voting for the Drupal Association Board’s Director At Large position opens this Monday, March 9th. My two main reasons for seeking this role, why I feel I am a qualified candidate, and a discussion on the responsibilities of this position are outlined in the following post.

My Main Reasons For Running

First, the “Director At Large” position is representing the whole Drupal Community inside the board. Therefore the person holding the board position should need to know and understand the community in all it’s facets. I believe I am one of those individuals who reaches across a wide spectrum of the community and can offer a higher representation. I help organize DrupalCons and Camps, speak at different Drupal events all over the world, give trainings, along with mentoring new users at sprints. I meet with other CxO’s and interested high level business associates to teach them how to contribute back to Drupal, and still maintain steady code contributions to core via the Drupal 8 Multilingual Initiative and contrib modules.

A Note Regarding Board Responsibilities

One really important piece of information I want to stop and make sure is understood, is what it REALLY means to be on a board of this nature. The Drupal Association Board is a strategic board, meaning the Board defines the strategic direction and policies of the Drupal Association. The execution of these goals is then in the hands of the Executive Director (Holly Ross) and her staff within the Drupal Association. My personal experience with this structure comes from being on the Board of Amazee Labs Zurich, where we define strategies and directions for the CEO. I feel I should explain and offer further definition of the role of a strategic board member. Often on a strategic board you are faced with wonderful ideas you would like to execute immediately or at times even execute yourself as the board. It is important to keep the responsibilities clear however, that you are there as a strategic guide and must let the company executives figure out how best to pursue and execute strategies.

This same distinction of responsibilities applies to the Drupal Association Board, and it’s candidates are signing onto a role within a structured system. The ‘Director at Large’ role gives an insight into the Drupal community’s general needs and stress points. The role does not include actions like the power to give direct orders to Drupal Association staff. While many may understand this distinction, it is important to make sure voters expectations are managed and candidates are reminded what they are stepping forward to take part in. This might sound overly structured (especially for a volunteer based community), but in the end the Drupal Association is a nonprofit with goals and budgets to follow. In fact budgets are more important than many realize. The Drupal Association Board is actually responsible for the financial oversight of the Drupal Association. What does this mean? It translates in legal terms to direct financial responsibility by all board members should the Association financially fault. That responsibility translates to a great deal of deep budgetary spreadsheet analysis conducted by members, both a very important and very tedious task. It’s like the issue queue: Someone has to review the code and mark it RTBC!

Thank you for taking the time to read where I stand on important issues and my public service announcement around what the responsibility of this candidacy truly means. I’m really looking forward to the upcoming vote beginning March 9th and ending March 20th. Until then, I strongly suggest everyone in the community check out all the passionate Drupal candidates keeping in mind not only their vision but experience in this type of role.

Should you have any further questions for me, I will be conducting a Reddit AMA this Thursday March the 5th starting at 5pm CET (11am ET).

Catégories: Elsewhere

3C Web Services: How to accept payments of varying amounts with Drupal Commerce.

Planet Drupal - mer, 04/03/2015 - 15:42

INTRODUCTION

The websites we build often require accepting a payment for something that isn't a product. For example, service payments, down payments or donations. There are different ways to handle this with Drupal Commerce and here we’ll outline the method we've adopted for use and explain how to implement it yourself.

CREATE A CUSTOM MODULE

Catégories: Elsewhere

Simon Josefsson: EdDSA and Ed25519 goes to IETF

Planet Debian - mer, 04/03/2015 - 15:30

After meeting Niels Möller at FOSDEM and learning about his Ed25519 implementation in GNU Nettle, I started working on a simple-to-implement description of Ed25519. The goal is to help implementers of various IETF (and non-IETF) protocols add support for Ed25519. As many are aware, OpenSSH and GnuPG has support for Ed25519 in recent versions, and OpenBSD since the v5.5 May 2014 release are signed with Ed25519. The paper describing EdDSA and Ed25519 is not aimed towards implementers, and does not include test vectors. I felt there were room for improvement to get wider and more accepted adoption.

Our work is published in the IETF as draft-josefsson-eddsa-ed25519 and we are soliciting feedback from implementers and others. Please help us iron out the mistakes in the document, and point out what is missing. For example, what could be done to help implementers avoid side-channel leakage? I don’t think the draft is the place for optimized and side-channel free implementations, and it is also not the place for a comprehensive tutorial on side-channel free programming. But maybe there is a middle ground where we can say something more than what we can do today. Ideas welcome!

Catégories: Elsewhere

Clint Adams: As one might expect, a white person responded to him.

Planet Debian - mer, 04/03/2015 - 15:19

“I think poor black people and white intellectuals using the same model is pretty telling, actually: the two most isolated sides of the spectrum,” he said.

Catégories: Elsewhere

Drupalize.Me: New Multisite Series plus Installing Drush with Composer

Planet Drupal - mer, 04/03/2015 - 15:15

This week, we're kicking off a new series, Working with Drupal Multisite. We're also releasing a new video in our Drush series, Installing Drush with Composer.

Catégories: Elsewhere

Victor Kane: Five Things I didn't know about Platform.sh

Planet Drupal - mer, 04/03/2015 - 14:54

I want to share some exciting things I'm only just finding out about Platform.sh (the “Develop, Deploy, Rinse, Repeat” continuous delivery cloud platform for Drupal, Symfony and PHP based projects) that look as if they might have a lot to do with folks finding a straightforward way of enabling a truly Lean process applied to website and web application projects. We'll cover five things I didn't know about Platform.sh:

  1. The Standard Platform Workflow is just what modern, serious PHP, Symfony and Drupal developers might expect and can easily be set up for all team members.

  2. The Standard Platform Architecture is container based and scales tremendously well for most use cases.

  3. They don't use Varnish! They use CDNs (content delivery networks)!

  4. There's an Enterprise Platform with its own truly scalable architecture and unique benefits

  5. A chance to get a first-hand report from someone actually using the Platform.sh Enterprise Platform.

read more

Catégories: Elsewhere

Zlatan Todorić: Interviews with FLOSS developers: Paul Wise

Planet Debian - mer, 04/03/2015 - 12:11

After starting with Joey Hess, we continue with Paul Wise. What makes his star to shine are many things such as being a DSA (Debian System Administrator), a helpful hand on mailings list, encouraging people to join Debian teams but most of all - he has encyclopedia knowledge on Debian as a whole which he gladly shares with anyone who asks (very fast response on IRC channels). It is almost impossible for any single person to count all Debian teams, work and places - to know most of those things, you can image the vast knowledge which Paul has. The legend says that his brain has better and faster search engine algorithm on Debian related queries than all other engines combined. So lets see what he has to share with world.

me: Who are you?

pabs: Paul Wise (pabs) and I have to say that I'm no-where near as knowledgeable as your intro suggests.

me: How did you start programming?

pabs: Messing around with fractals and graphics things in MS BASIC.

me: How would you now advise others to start programming?

pabs: Pick an issue in a tool you use, investigate how the tool works and how you can change it, fix that and contribute the change back to the project that created that tool. In the process you will learn skills, interact with the community and contribute to the project.

me: Setup of your development machine?

pabs: Lenovo Thinkpad with external monitor, Debian testing and some tweaks

me What is your preferable language (for hacking)? Why? How do you compare it to other languages?

pabs: I currently prefer Python for its readability. It still has some rough edges though the documentation covers them fairly well. I generally pick up new languages when working on projects written in them. Haskell is next on the horizon due to Nikki and the Robots.

me: Describe your current most memorable situation as software developer/hacker?

pabs: I had a great time creating fractals in BASIC, learning about the Mandelbrot set, L-systems and more. My days and nights of hacking on frhed (a GPLed hex editor for Windows) to help me cheat at Civilisation were pretty memorable. frhed led to my work on reverse engineering the CHM file format (a documentation format for Windows programs). A stand-out moment during my time with Debian was hacking on the derivates census patch generation code during the Debian UK BBQ weekend, surrounded by geeks playing Portal, cooking things, hacking on Debian and generally having a good time (thanks Steve!).

me: Some memorable moments from Debian conferences?

pabs: There are so many; meeting Debian folks, playing Mao once and then never again, late night games of werewolf, both delectably delicious and hideously disgusting cheeses, fried insects, day trips to beautiful landscapes, inspiring keynotes, exciting BoFs, secret IRC channels for planning surprise birthday parties, blue hair, wet air, blocks of fried cheese, a vast quantity of icecream, pants, geeks in the surf, volcanoes, hiking, a wonderful view, a uni-cycling stormtrooper & more.

me: How do you see future of Debian development?

pabs: I hope we will continue to exist and uphold our principles for the foreseeable future. I don't have any crystal balls though.

me: You recently became member of Debian DSA - what is that like, what roles do you have and what tasks are in front of DSA?

pabs: We wrote a bit of text about that for DPN recently.

me: You have large knowledge on Debian and you share it with anyone who wants to know more. What motivates you to do so?

pabs: I want the operating system I personally rely on to exist into the future, helping folks work on and join Debian can help with that.

me: Why should developers and users join Debian community? What makes Debian a great and happy place?

pabs: Every Debian contributor has different reasons for joining the community. Personally the Social Contract, the DFSG and the spirit and culture behind them are the main reason to be involved. I also like our many efforts towards technical excellence and correctness. Of course I've made a number of good friends over the years, especially as a result of attending DebConf every year since 2007.

me: You are member of Debian publicity team which writes Debian news - do you need more people to join that team and how can they start?

pabs: Since there is an infinite amount of work to do, pretty much every part of Debian always needs help, that includes the publicity team. We published a post about ways to help here.

me: If someone wants to contribute to Debian in terms of packaging, can they do it anonymously (for example over Tor network, does Debian have .onion address)?

pabs: Due to Debian's penchant for transparency it is harder but there are definitely package maintainers who have built up a reputation for good work under a pseudonym over the years and become Debian contributors as a result. I'm not aware of completely anonymous package maintainers but there are definitely people who file bugs using one-off pseudonyms, which is almost the same thing as anonymously. There are definitely Debian contributors and members who use Tor while contributing to Debian. In fact, as Debian is very highly dependent on OpenPGP and the best practices for OpenPGP include refreshing your keyring slowly over Tor, so probably quite a number of Debian contributors use Tor. As far as I know Debian itself does not run any Tor relays or onion services.

me: What are places that non-packaging developers and people could join and help spread Debian even more?

pabs: There are many ways to help Debian, including non-technical ones. Unfortunately our web page about helping Debian isn't quite up-to-date with all of them but a few more are to volunteer at DebConf, helo with artwork requests, speak about Debian at events or even come up with ideas for projects. Whatever skills you have, Debian can probably make use of them. If you aren't sure where to start, jump on the debian-mentors mailing list or IRC channel and we can probably guide you to the right place within Debian. Don't worry about not being skilled enough, everyone starts somewhere.

me: How do you see Debian will manages webapps?

pabs: Personally I prefer locally installed software, standard data formats and standard data transfer protocols to the wild webapps world but I understand they are becoming very popular to produce and use due to the ubiquity of the web browser platform. Antonio Terceiro is mentoring a project for this year's newcomer mentorship programs (outreachy/gsoc) that aims to improve support for installing web apps on Debian installations. I hope it succeeds as it could help make Debian more popular on servers and home servers in particular.

me: How would you advise Debian (and other FLOSS users) to setup their machine in terms of security and anonymity?

pabs: All technology has upsides and downsides. I would advise anyone to analyse their situation and protect themselves accordingly. For example if you have a bad memory, full disk encryption, which is based on pass-phrases might lead to data loss and physical security might be a better choice for protecting your data. The right choices around technology are very much a personal thing.

me: Is it better to setup xmonad (because it is Haskell based WM) with small dependency chain or GNOME (because it is getting sandboxed apps) in term of security and privacy implications?

pabs: Again, the right choices around technology are very much a personal thing. Due to the design of X11, both of these are approximately equivalent from a window-manager security properties point of view, that is to say, pretty bad. Wayland is one of the possible X11 successors and offers much better security properties. GNOME folks are working on switching to Wayland. Ultimately though it comes down to how each person uses their window manager and which software they run under it.

me: Should Debian join Tor project as distro that installs Tor relays by default - should it offer that as option in installer in Debian 9?

pabs: Running a Tor relay requires a reasonably fast and reliable Internet connection and should be a conscious decision on behalf of the sysadmin for a computer so Debian probably shouldn't install them by default. If tasksel gets support for installing tasks from Debian Pure Blends, then we could add a Tor relay task to the Debian Sanctuary Pure Blend.

me: Have you ever considered joining initiatives such as FreedomBox?

pabs: I was quite moved by Eben Moglen's talk at DebConf10 in New York and the resulting BoF. It seemed like a very ambitious project but I didn't really have the knowledge, skills or time to contribute yet.

me: Are you a gamer? Valve Steam games are offered for free to Debian Developers - do you use steam and play Valve games? Your thoughts on Steam and non-free Linux gaming?

pabs: I play computer games occasionally, all from Debian main or ones that I'm packaging. 0ad is my current go-to for a bit of gaming. I don't have any experience with Steam or non-free games on Linux.

me: Is there something you would change in FLOSS ecosystem?

pabs: Various folks have highlighted new and ongoing challenges for the FLOSS ecosystem in various places in recent years.

Something that I would like to highlight that does not get talked about enough is the choices we make around our digital artefacts. This is the discussion around "preferred form for modification" or "source". The "source" for a particular digital artefact is a deliberate choice on behalf of the authors. Often generated files are distributed alongside the "source" without any instructions for reproducing the generated files from the "source". It sometimes happens that FLOSS contributors forget to distriute what they have chosen as "source", instead just distributing the generated files. This is a fairly well known issue but still happens. What isn't thought about quite as much is that the choice of "source" has consequences for future development possibilities of that "source". Some forms of "source" are more expressive than others, can be modified in a wider variety of ways and are better choices in general. Sometimes the consequences of choosing less expressive forms are mild and other times they are quite important. I hope more people will start to think about these choices. Some examples where, in my opinion, various people could have made better choices are listed in the mail I sent to the games team list last year.

Another thing I would like to highlight is the work that organisations like Software Freedom Conservancy and Software in the Public Interest do to protect, defend, promote and support FLOSS projects. It is very important work that needs our interest and support.

me: Can FLOSS world create great alternatives to Viber, Dropbox, WhatsUp, Facebook, Skype and other non-free services?

pabs: I think that the FLOSS world has already created alternatives to all of those. The success of non-free services doesn't take these alternatives away but it does mean some of them are less useful because some of them are the kind of tools that become more useful with a larger amount of people using them. I don't know what it would take for the FLOSS alternatives to achieve similar success as network effects are hard to overcome. Hopefully mako is right and the network effects are overrated.

me: Your thoughts and compare Cloud, IaaS, PaaS, SaaSS? To what should the FLOSS world pay more attention and energy?

pabs: Initially I dismissed these as buzzwords and a threat to Free Software. These days I view them as potential opportunities for Free Software. Cloud-related technologies such as OpenStack and virtual machines can make private compute farm hardware more flexible and useful to their owners. IaaS providers can be used to run Debian more simply and cheaply and therefore bring Debian to more people than possible with hardware. PaaS providers can be used to run Free Software services. SaaSS can be based entirely on Free Software and respect users. Of course, just like running Free Software on hardware (proprietary or libre), cloud technology, IaaS, PaaS and SaaSS all come with downsides. The FLOSS world should aim to inform users of our software of these downsides. For example, the Debian installer could note that it is running on Intel CPUs with a proprietary BIOS and various proprietary software running, that it is running on a mobile phone with a locked bootloader, that it is running in a Xen VM on machines owned by Amazon. Free Software services could note they are running on Google App Engine etc. Free Software web browsers, chat clients etc could note when they are connecting to proprietary network services. All these notes could inform users about the downsides present in the particular situation encountered. There is also much work to be done making it easier to run Free Software on top of or use Free Software to connect to all manner of platforms from lowRISC to UEFI to VMware to Google App Engine to GitHub to Facebook. The more places Free Software can reach, the more people will be exposed to the philosophy behind it and the more potential there is for folks to join the community. While co-option of the FLOSS world is a dangerous certainty, co-option of proprietary platforms might be able to expand the reach of the philosophy behind Free Software.

me: Your thoughts on Purism (the open hardware laptop initiative that got recently funded on CrowdSupply)?

pabs: I don't know enough about that to comment but personally I am more interested in a laptop based on a libre CPU architecture. The RISC-V ISA and the lowRISC project seems to be one of the more promising possibilities at this point in time.

me: Did you watch Citizenfour - comments on it?

pabs: I've seen the trailer and look forward to watching it at some point, I read there might be a screening at DebConf15.

Catégories: Elsewhere

Acquia: Working with simplytest.me and Drupal.org

Planet Drupal - mer, 04/03/2015 - 10:01
Language Undefined

Tips and tricks for getting the most out of simplytest.me – Patrick Drotleff is a passionate contributor to the Drupal project whose work – including simplytest.me, pareview.sh, and the tongue-in-cheek BreakingHead card game – often centers around building tools that help others contribute to Drupal. Within minutes of Drupal 8 beta being announced at DrupalCon Amsterdam, I saw a tweet saying it was available to try out on simplytest.me. Though I had used the service before, I wanted to know how it actually worked and Patrick was kind enough to agree to show it off here on jam's Drupal Camp.

Catégories: Elsewhere

lakshminp.com: The Drupal 8 plugin system - part 3

Planet Drupal - mer, 04/03/2015 - 08:32

Checkout part 1 and part 2 for understanding the concept of plugins.
In this installment, we will be

  1. Implementing a new plugin from existing plugin types.
  2. Implementing a new plugin type using the annotation based discovery mechanism.

As an exercise, let's first construct an imaginary scenario where the user of your Drupal site wants choose what they want for breakfast from a list of breakfast menu items. To add a dash of variety, all the breakfast items in the code are of South Indian culinary. You can checkout the code and suit yourself, change the breakfast items etc.

For this exercise, checkout the module code first and enable it.

$ git clone git@github.com:badri/breakfast.git

In order to select their breakfast item of choice, the user needs to be presented with a list of choices in their profile. The lame way is to create a list field in the user profile and add all the breakfast choices. This offers limited functionality and is not pluggable. We can do better than that. So, let's ahead and create a custom field called breakfast choice.

This functionality is there in the custom-field-no-plugin tag of the code you previously checked out. You can switch to that tag by:

$ git checkout -f custom-field-no-plugin

After you enable the breakfast module, go to the user profile and create a new field of type "breakfast choice". As the tag says, we haven't created any custom plugin type yet. But we do create a new plugin from the existing plugin types for our custom field. In fact, we create 3 new plugins(one each for the field type, field formatter and field widget). Our directory structure looks like this:

All the breakfast menu items come from a single location, your custom field widget, the BreakfastWidget.php file.

public function formElement(FieldItemListInterface $items, $delta, array $element, array &$form, FormStateInterface $form_state) { $value = isset($items[$delta]->value) ? $items[$delta]->value : ''; $options = array( 'idly' => 'Idly', 'dosa' => 'Dosa', 'uppuma' => 'Uppuma', ); $element = array( '#type' => 'select', '#options' => $options, '#default_value' => $value, '#multiple' => FALSE, ); return array('value' => $element); }

Though it works, this is not a good design for 2 reasons:

  1. You are hardcoding in the presentation layer. Widgets define the way you present the input element in a form. You can't define your data there.
  2. It is not pluggable. Other developers have to open BreakfastWidget.php to add new Breakfast items.
  3. It cannot be extended. What if I want to add additional properties to my breakfast items, like images, ingradients or price? I cannot do this in the current setup.

We will address problems 1 and 2 for now. i.e., we add the ability to create new breakfast items outside of the Breakfast Widget file. We make breakfast items "pluggable". Other modules can add new breakfast items it were a plugin, which is exactly what we do next.

To get the plugin version of the module, do:

$ git checkout -f plugin-default-annotation

Now, our directory structure looks like this:

The BreakfastPluginManager is, as the name says, a service used to manage various breakfast plugins across modules.
The plugin manager's constructor class deserves some explanation.

public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, LanguageManager $language_manager, ModuleHandlerInterface $module_handler) { $subdir = 'Plugin/Breakfast';

The $subdir tells the plugin manager where to look for Breakfast plugins in a module.

$plugin_definition_annotation_name = 'Drupal\Component\Annotation\Plugin';

The $plugin_definition_annotation_name is the namespaced name of the annotation class which is used to annotate all Breakfast plugins. Plugin is the default annotation. We can define custom annotations as well, which will be the subject of the next installment in this series.

parent::__construct($subdir, $namespaces, $module_handler, $plugin_definition_annotation_name); $this->alterInfo('breakfast_info'); $this->setCacheBackend($cache_backend, 'breakfast_choice'); }

alterInfo tells us that this plugin definition can be altered by implementing hook_breakfast_info_alter.

Plugin definitions are cached, which is why we need to run drush cr(the equivalent of drush cc all in D8) every time we alter the plugin definitions. The setCacheBackend defines the cache backend for our plugin. In the current context, we are not customizing it too much.

Another major change is the new file breakfast.services.yml. It contains metadata about the breakfast plugin manager service which we discussed above.

services: plugin.manager.breakfast: class: Drupal\breakfast\BreakfastPluginManager arguments: ['@container.namespaces', '@cache.default', '@language_manager', '@module_handler']

One or more services can be defined in the services.yml file. Each entry contains a machine name of the service, the class that implements the service and dependencies(if any) can be passed as arguments. The @ prefix for the arguments indicates that the corresponding argument is in itself a service.

The field type we added earlier hasn't changed, but the widget has been revamped. We no longer hardcode any breakfast items. Instead, we dynamically pull all plugin instances of type Breakfast.

Here's how:

$options = array(); $breakfast_items = \Drupal::service('plugin.manager.breakfast')->getDefinitions(); foreach($breakfast_items as $plugin_id => $breakfast_item) { $options[$plugin_id] = $breakfast_item['label']; }

Any module can now define a new breakfast menu item and expect it to show up in the user profile's breakfast field dropdown. We've created 3 breakfast items in our module to illustrate this. Let's pick an example breakfast plugin, my favorite. Masala dosa.

Image courtesy

err, I meant:

/** * Adds Masala Dosa to your Breakfast menu. * * * @Plugin( * id = "masala_dosa", * label = @Translation("Masala Dosa") * ) */ class MasalaDosa extends PluginBase { // Nothing here yet. Just a placeholder class for a plugin }

Nothing fancy there. Just a placeholder class and some metadata in the @Plugin annotation.

Phew! It took more time to add a masala dosa plugin that to make a masala dosa. Each breakfast item being a unique plugin instance sounds a bit like an overkill. We will address this and problem #3 detailed above(plugins having different properties like picture) in the next post!

Catégories: Elsewhere

Mark Ahrens: Backdrop Does a Disservice to Developers

Planet Drupal - mer, 04/03/2015 - 05:00
I have been thinking awhile about why the Backdrop fork bothers me so much. At first I thought it would just be the fact that it will be splitting the community some or taking resources away from the Drupal project. But lots of projects I have worked with have been forked in the past, and it … Continue reading Backdrop Does a Disservice to Developers
Catégories: Elsewhere

Drupal @ Penn State: Memory profiling in hooks

Planet Drupal - mar, 03/03/2015 - 22:19
To start..

This tutorial involves hacking core. If you aren't comfortable with doing that, you're probably in the wrong place :).  I created a dropbucket.org drop called Memory profiling in hooks which has all the code details in case you want to dig in yourself.  You'll need to modify includes/module.inc and also have devel module enabled for this to work.

Catégories: Elsewhere

Mediacurrent: Premature Optimization is (still) Bad

Planet Drupal - mar, 03/03/2015 - 22:13
Knuth is a pretty smart person

A long time ago, in a galaxy right here, Donald Knuth wrote “premature optimization is the root of all evil”. This was in his 1974 paper “Structured Programming With Go To Statements”, yet this issue is still with us in various forms.

Catégories: Elsewhere

Urban Insight: What to visit while at the Los Angeles DrupalCon

Planet Drupal - mar, 03/03/2015 - 22:07

So you are planning to visit LA for DrupalCon? Want to site see or enjoy local flavors but not sure where to focus your efforts? I polled the team at Urban Insight, and we collected ected a few of our own favorites that will, hopefully, become some of your favorites as well.

#10 LA Metro

http://www.metro.net/

Catégories: Elsewhere

Daniel Pocock: Wrong day or wrong volcano?

Planet Debian - mar, 03/03/2015 - 20:12

On our last visit to Chile, we stayed in Pucon for a few days and went to climb the Villarrica volcano:

It is demanding (1500 meter rise in elevation from the bus stop, crampons must be worn on the glacier) but the view is breathtaking. While we were there, another nearby volcano erupted.

Today, Villarrica Volcano had its turn:

Catégories: Elsewhere

Pages

Subscribe to jfhovinne agrégateur - Elsewhere