Inhalt abgleichen
Drupal.org - aggregated feeds in category Planet Drupal
Aktualisiert: vor 2 Minuten 11 Sekunden

Drupal.org blog: What’s new on Drupal.org? - November 2018

18. Dezember 2018 - 19:44

Read our Roadmap to understand how this work falls into priorities set by the Drupal Association with direction and collaboration from the Board and community.

DrupalCon Give thanks with your Drupal Family at DrupalCon

What better way to connect with your Drupal family and give thanks for Drupal's impact than at DrupalCon? Still need to register? Coming on your own? Now's a great time to lock in a good price.

If your organization is sponsoring your trip, consider investing those end of year budgets in your registration... and invest in Drupal's success while you do it. Your team can also sign up for or renew your Supporting Partnership for steep discounts on ticket prices.

The schedule is available now; check out the specialty sessions and register before prices go up!

Kicking off planning for DrupalCon Amsterdam

Members of the Drupal Association team traveled to Europe to meet with Kuoni Congress and, the DrupalCon Europe advisory committee do a kick-off meeting and deep dive on the event planning for DrupalCon Amsterdam. This was our opportunity to dive deep into the event with the team, and it was a tremendously productive 2-day session.

More news about Amsterdam will be coming soon, so check back at https://events.drupal.org/amsterdam2019 soon!

(Image courtesy of Baddy Breidert)

Drupal.org Updates New telemetry data about Drupal usage

In November we also re-architected the way we parse data from sites that call back to Drupal.org for updates. This allowed us to learn more about how Drupal is used in the wild. This graph shows the current distribution of PHP versions for Drupal 8 sites. Notably only about 20% of Drupal 8 sites are still using PHP 5, so the migration effort for the community may not be as big as some expected when PHP 5 reaches end of life.

Finding a new Technical Program Manager

As Tim has stepped into the role of interim executive director, we've been looking to bring a new team member onboard to backfill some of his technical responsibilities. In November we interviewed candidates for our Technical Program Manager position. We're excited to have our new team member join in the new year!

Drupal.org/community changes live!

The changes outlined to the Drupal.org community home page that we outlined in our October update are now live. This new entry point to the Drupal community addresses the many different needs that a new member of our community might have, and the different personas that they might represent. The home of the community will continue to evolve over time, so expect to see more updates soon, and please offer your feedback here.

Drupal Association Updates Executive search firm selected

As you know, we've begun the process of looking for our next Executive Director. In November we interviewed executive search firms to help us with this process, and in early December we announced that we've selected Lehman Associates to help us with our search. If you would like to read the candidate profile, or contact Lehman Associates to offer candidate suggestions or provide other feedback, please use the button below.

View the profile

———

As always, we’d like to say thanks to all the volunteers who work with us, and to the Drupal Association Supporters, who make it possible for us to work on these projects. In particular, we want to thank:

If you would like to support our work as an individual or an organization, consider becoming a member of the Drupal Association.

Follow us on Twitter for regular updates: @drupal_org, @drupal_infra

Debug Academy: The new layout builder’s impact on Drupal’s evolving learning curve

18. Dezember 2018 - 19:44
Author: Ashraf Abed, Jack Garratt

Developers and organizations alike continue to use Drupal for large-scale projects due to its modular architecture, solid data model, community, security team, stability, and good-fit for many “ambitious” projects. However, historically, Drupal has caught considerable flak for its unintuitive development process - that might finally be changing.

I have been teaching Drupal development at Debug Academy ( https://debugacademy.com ) for over 4 years now. One recent development piqued my interest, especially in regards to teaching newcomers how to build sites using Drupal, and that is the new layout builder in Drupal core. The layout builder was released as an experimental Drupal core module in Drupal 8.6.

Drupal 8.6, and the layout builder (experimental at the time), were released on September 5, 2018, and our summer semester was scheduled to end on September 9th. Due to a combination of excitement and a desire to teach what I firmly believe to be the soon-to-be standard technique for building Drupal websites, we did not wait to use it. We built the entire website except for internal landing pages themselves before September 5th, the day the layout builder was released and 4 days before the conclusion of our semester. We combined custom block types with the new layout builder to finish building the website.

And my, it was easy to understand and to teach. Since then, we’ve integrated the layout builder more deeply into our subsequent semester and the results bode well for Drupal’s future. The client loved the new layout builder functionality, and the students who were newest to programming felt more comfortable than ever when laying out our custom landing pages. But don’t take my word for it, let’s take a look at the data.

How pages are built in Drupal Common use cases for page creation include:
  • Advanced custom pages

    • Developers can build individual pages (routes) using raw PHP to pass information from various sources (such as internal or external APIs) to the page.

  • Standardized pages as content

    • Users create content (“nodes” in Drupal nomenclature) with standard layouts for displaying the content’s data.

  • Pages with custom overrides

    • Developers can override pages’ default output and pass additional data to specific pages with PHP.

  • Semi-structured content

    • Users can embed standardized “blocks” of content in or around otherwise standardized pages.

  • Drag & Drop content placement

    • Content editors can drag & drop specific types of content through UI onto pages.

Drupal’s solutions for these use cases
  • Advanced custom pages

    • Custom route built in PHP utilizing Drupal’s API

    • HTML with Twig

  • Standardized pages as content

    • Create pages using the UI. Similar to creating a blog post.

    • Without writing any code, site builders can also create pages featuring different types of fields using Drupal’s content type system.

  • Pages with custom overrides

    • Create pages using the UI. Similar to creating a blog post.

    • Pass additional variables (such as a newsletter block) to the page with PHP

    • Render variables using Twig

    • Write any markup (HTML) directly in the Twig file

  • Semi-structured content:

    • Create “paragraph” types (sets of fields)

    • Embed “paragraph” content within a field on the content type

  • Drag & Drop content placement (the new layout builder!)

    • Create pages using the UI. Similar to creating a blog post.

    • Use drag & drop to place / remove layouts, sections, fields, blocks, and more!

    • Can be done per content type and (optionally) overridden per page

Comparison of the content creation options in Drupal

Drupal provides an abundance of solutions to problems content editors face. Different tools require different skillsets, so although Drupal has solutions for everything, let’s do a deeper comparison of the Drupal 8 content editing options to see what is available, what it can do, and how accessible it is to you and your team. The new layout builder is highlighted in the rightmost column:

 

Advanced custom pages

Standardized pages as content

Pages with custom overrides

Semi- structured content

Drag & Drop content placement (new layout builder!)

How to: initial set up

  • Git

  • PHP

  • Twig

  • YML

  • Site building

  • Site building

  • Git

  • PHP

  • Twig

  • YML

  • Site building

  • Site building

  • Site building

How to: add'l pages w/same layout

Depends on implementation

Content editing

Content editing

Content editing

Content editing

How to: add'l pages w/custom field layouts

  • Git

  • PHP

  • Twig

  • YML

  • Site building

N/A

  • Git

  • PHP

  • Twig

  • YML

  • Site building

*Content editing

 

*

pre-grouped sets of fields must all be displayed sequentially

Content editing

How to: add'l pages w/custom layouts, including mixing & matching blocks, fields, & more

  • Git

  • PHP

  • Twig

  • YML

  • Site building

N/A

  • Git

  • PHP

  • Twig

  • YML

  • Site building

N/A

Content editing

How to: Component-based design support using Drupal blocks within content area

Custom code only

N/A

Custom code only

“Pre-grouped” fields can be designed as components, but placement is very restricted

Fully supported

Uses core/contrib

Core

Core

Core

Contrib (paragraphs)

Core (experimental - full release expected in 8.7!)

In practice: what do the numbers show?

Through our courses we have been able to collect data about how the switch from other approaches (namely PHP / Twig & paragraphs) to the new layout builder has impacted the learning curve, productivity, and ongoing maintenance of projects. Debug Academy’s Jack Garratt ran the numbers for us. For the sake of our analysis, a “task” refers to the smallest unit of work assigned to a developer (Debug Academy student, in this case):

The data: before the layout builder (“Tasks to homepage”)

Let’s take a look at the data following the number and type of task from the start of the project until the completion of the frontpage and set up of internal pages. In the first data set, we’ll look at our projects before use of the layout builder.

We assigned our students to implement PHP pre-process hooks to create Twig variables for Views blocks, blocks provided by contrib modules (e.g. newsletter), as well as extracting other non-block data from the website.  Note: There are alternatives in Drupal’s contrib space to using PHP, such as the contributed module Twig Tweak; we do not encourage using Twig Tweak in our projects. The project builds are a success; however, it is also not the most readily grasped by non-web developers and clients.

The breakdown is below:

Task Type

Pre-layout Builder

Up to & including homepage (without layout builder)

Twig

17 (task per section per page)

Site Building

14

Configuration in Code/Site installation and setup)

7

CSS/SASS

6

PHP/Custom Module

10

Initial Theme setup

3

Set up reusable inner page layouts (4 content types)

Twig

8

PHP

4

CSS/SASS

4

PHP and Twig tasks constitute a significant number of the total amount of work completed by our students.  Out of the 17 Twig tasks, we deemed that 10 required using PHP to pass various blocks to the homepage for a variety of use cases, such as embedding Twitter or a Donately form within the page’s content.

On subsequent projects, our students are constructing the pages in the Layout Builder.

The data: using Drupal’s new layout builder (“Tasks to homepage”)

The Layout Builder UI has access to the aforementioned block types.  If there is a specific need that cannot be readily replicated with custom block types with the requisite fields, developers can still use Twig to add that functionality.  However, we found that creating and styling custom block types in Drupal 8 core as reusable components (see component based design) greatly streamlined our process and eliminated the need for many higher complexity tasks. 

What we soon realized was that writing PHP and Twig was less needed in terms of individual page construction, but still rather helpful in crafting custom blocks (components).

Task Type

Pre-layout Builder

Up to & including homepage (with the new layout builder)

Twig

5 (task per component type)

Site Building

18

Configuration in Code/Site installation and setup)

7

CSS/SASS

6

PHP/Custom Module

0

Initial Theme setup

3

Set up reusable inner page layouts (4 content types)

Twig

1 (we’re reusing component types)

PHP

1

CSS/SASS

1

One of the consequences of the de-emphasis on using Twig to create basic pages with custom HTML in favor of the layout builder is allowing a more beneficial division of labor.  Teams may create more tasks that involve basic page building to get their newer developers familiar with the Drupal UI. Moreover, companies can train their clients in how to create basic pages with customized blocks (video block, stylized quote block, or a button block to name a few), which minimizes the instructional curve.  Essentially, the tasks to create highly customized pages no longer require coding. One consequence of using the layout builder for basic page creation in this manner is that it will free up more experienced developers to focus on other tasks or minimizing oversight of newer developers.

The data: full comparison, beyond the homepage

The above charts compare “time to homepage” and “time to generic inner page”. Where you really start to see the benefits are when you’re creating a website with many pages. Let’s look at the combined charts, calling special attention to the newly added last row(s) “Creating additional pages with custom layouts”:

Task Type

Pre-layout Builder

With Layout Builder

Up to & including homepage

Twig

17 (task per section per page)

5 (task per component type)

Site Building

14

18

Configuration in Code/Site installation and setup)

7

7

CSS/SASS

6

6

PHP/Custom Module

3

0

Initial Theme setup

3

3

Set up reusable inner page layouts (4 content types)

Twig

8

1 (reusing component types)

PHP

4

1

CSS/SASS

4

1

Creating additional pages with custom layouts

Twig

37

2

PHP

16

4

Content Editing

47

69

Site building

45

17

Thanks to a combination of component based design and the new layout builder, content editors can create truly custom layouts without writing a line of code. They can, for example, drop a video embed in between the body field and the author field, move the author field to the footer, and arrange other fields in 3 columns without writing a line of code.

Summary & Conclusion:

This specific project built with the layout builder required:

  • 88% less PHP tasks

  • 64% less site building tasks

  • 87% less Twig tasks (thanks to component based design)

  • 46% more content editor tasks

The numbers are clear. Drupal’s layout builder has the potential to bring down the cost of ownership of Drupal websites significantly by enabling content editors and less senior developers to build more of the website. Because of which, the new layout builder will make Drupal more accessible to newer developers and smaller organizations with ambitious goals for their web-powered presence.

It’s time to get up to speed in Drupal 8!

Debug Academy's real projects are the source of the above data, and we encourage you to take a look at our programs. There has never been a better time to add Drupal to your skillset.

We will continue to incorporate cutting edge tech in our courses, including the new layout builder, Composer, Drush, Drupal Console, Object Oriented Programming with PHP7, and much more, all applied to a real, unique, team project! At the end of it all we help students continue to the next phase of their careers! Visit https://debugacademy.com to sign up for one of our free info sessions - our next semester begins January 27th!

P.S. thanks to Dries Buytaert for providing feedback on this post!

Drupal.org blog: What’s new on Drupal.org? - October 2018

18. Dezember 2018 - 19:29

Read our Roadmap to understand how this work falls into priorities set by the Drupal Association with direction and collaboration from the Board and community.

Lock in your DrupalCon tickets before the end of the year

DrupalCon Seattle is shaping up to be an outstanding conference. If your organization is sponsoring your trip, now's a great time to use your 2018 budget to register to attend. Your team can sign up for or renew your Supporting Partnership for steep discounts on ticket prices. Coming to DrupalCon on your own? The schedule is available now, so peruse the offerings and register before prices go up!

Drupal.org Updates A new taxonomy for DrupalCon sessions

As you've seen if you clicked the link to the schedule above, events.drupal.org was updated to support session submission by tag, rather than track, earlier this year. This provides more flexibility in finding the content you're interested in, and encourages sessions which cross the boundaries of traditional tracks.

Prototyping a new Try Drupal experience

In October we put together a visual prototype of our proposed revamp of the Try Drupal program. This includes a better, more targeted user experience for each persona, as well as the opportunity for more organizations to participate. More details will be shared soon as we get further along, but for a sneak preview you can review the operational update from our recent public board meeting.

Improving the experience of using Composer

In October significant progress was made on the initiative to Improve Drupal Core's use of Composer. In particular, kicking off the primary issue for building this better support into Core, as well as moving the issue for supporting Semantic Versioning for Contrib from a plan to the implementation phase. These changes will improve the user experience for Drupal users with composer based workflows, and especially for Drupal users who start sites without Composer, and then switch to Composer based workflows. This also lays the groundwork for necessary steps for supporting the Drupal 9 roadmap.

Promote Drupal Releasing the first draft of the Drupal Brand Book

In October, with the feedback of the Promote Drupal volunteer team, we developed and released the initial draft of the Drupal Brand book. This is one of the materials created by the Promote Drupal initiative, in order to unify the brand presentation for Drupal across agencies, internal sales, and regions. This will be updated with a vision statement for Drupal's business strategy and market position.

A new Community Section

In October we also spent time creating a beta experience for a new Drupal.org/community landing page. This page focuses on the onboarding process, helping visitors identify their need and persona, so they can get to the segment of the community that is relevant to them. (Hint: this beta experience has since gone live!) If you have feedback about making the community portal better, you can leave your suggestions in the drupal_org_community issue queue.

———

As always, we’d like to say thanks to all the volunteers who work with us, and to the Drupal Association Supporters, who make it possible for us to work on these projects. In particular, we want to thank:

If you would like to support our work as an individual or an organization, consider becoming a member of the Drupal Association.

Follow us on Twitter for regular updates: @drupal_org, @drupal_infra

Sooper Drupal Themes: Create a Drupal Pricing Page with Glazed Builder

18. Dezember 2018 - 16:44

The pricing page is one of the key pages in a website, therefore it is important to have a clear and professional design that communicates the product benefits and pricing tiers your business offers. In today’s article we are going to learn how to recreate the new Sooperthemes pricing page. The Sooperthemes pricing page has a clean design style that mainly consists of rows, columns and text. Throughout this article we are going to work with the following elements:

  • Rows
  • Columns
  • Text
  • Buttons

OpenSense Labs: Content driven Commerce with Drupal 8: Another Feather in the Hat

18. Dezember 2018 - 15:53
Content driven Commerce with Drupal 8: Another Feather in the Hat Akshita Tue, 12/18/2018 - 19:23 “Sometimes I would buy Vogue instead of dinner. I felt it fed me more."  — Carrie Bradshaw from The Sex and the City

Consumer instincts have changed with time and so have market tactics. Today, the global brands not only selling the product, but they are also building a journey with the shopper, an impression that stays longer than the product (no pun intended). 

When shopping online it’s about knowing every little detail, almost like visiting the market and buying the product. Shopping is no more just about checking out the product and adding it to cart.

It is here that the commerce meets content.

And that is why everything has a story. This author, the perfume she wears, the website, images, rock, paper, scissors… everything.

Can Drupal provide the commerce organization the storyboard that they are looking for? And what about the conversational UI that is booming in the commerce industry? Can Drupal stand up to the expectations of its customers?

 

The Content-Driven Commerce. What is the Concept About?

Despite the fact that we have been experiencing content and commerce together since the start of marketing, content-commerce has never, until now, existed as a concept in itself. 

The best example of content-driven commerce are print magazines and that is what the retailers and business corporations have been trying to imitate online, today. 

An advertisement does that. Why aren’t we focussing there?

In 2013, Lab24 - an American market research firm - carried out a study that revealed that people had some serious trust issues with advertising. 

  • 76% of people believe that ads are “very exaggerated” or “somewhat exaggerated”.
  • 87% think half or more cleaning ads are photoshopped.
  • 96% think half or more weight loss ads are photoshopped.

Building a personal repo is more important than just throwing content in the form of ads. Meaningful content puts a filter on such garbage advertising also bringing rewarding results!

The fact that businesses can no longer ignore customers’ desire for content, purpose, is what has been changed in the market.

And yet, more often than not, online shops still resemble soulless product catalogs.

The story of Coco Chanel and her perfume No 5 is very beautifully presented in the series of 5. 


With the help of blogs, user-generated content, and rich multimedia, brands are not only able to stand out from the crowd, but also provide a curated commerce experience to their customers. 

However, product-centric their content may be, it still establishes an emotional connection with customers through inspirational stories that pave the road to successful commerce.

Understanding the Concept with Timex

The famous American watchmaker Timex and its 22 sites are built on Drupal. The iconic brand offers intuitive navigation and engaging mix of product, social, and editorial content. This website infuses content in the entire shopping experience, doing an amazing job of featuring useful imageries and text that is relatable to customers.


Timex needed to ensure a unified brand experience on all its sites while also delivering digital content relevant to local markets - allowing the addition of new product content when and where needed.

Drupal ensures that the content generated in the U.S. is localised as per the location and published to local markets according to their needs. 

Not only does it enable the team to deploy content across regional websites rapidly while remaining on-brand, but it also supplements them with an ability in fueling the company’s international growth.

Why Opt For Drupal When Building Content and Commerce?

Helpful content, and not discounts, should be the centerpiece of awareness. And that’s exactly the role that content is meant to play in commerce.

With the Lab24 statistics, it is clear that - while all the e-commerce platforms aim to serve their users with a better experience, without leveraging the power of storytelling it is not possible. 

As the admin to an online store, you need to select and add the various content types that you are looking for. Be it blogs, testimonials, customer reviews, or product description, Drupal has it all for you. 

Drupal is unique in its ability to easily integrate into ambitious commerce architectures in precisely the manner the brand prefers. Drupal can be integrated with other e-commerce platforms giving rise to a hybrid solution. The third-party platforms can typically interact with the users either through the glass as in the case of a headless commerce solution or it can work side by side. 

In any case, Drupal can cover the need for the content driven user experiences with the homepage, marketing-driven landing pages, blog content while commerce features such as the product detail, category landing pages, and the cart and checkout flow can be handled by the e-commerce platform. 

Whatever the case maybe content types are at the core of Drupal. 

  1. Easy Content Authoring: Intuitive tools for content creation, workflow and publishing make it easy for content creators. User permissions, authentication help manage the editorial workflows efficiently. Previews help the editors access how the content will look on any device before the users approve and publish.
     
  2. Mobile Editing: Team members can review, edit and approve content from mobile devices, to keep content and campaigns flowing, regardless of where they are and what device they’re on.
     
  3. In-place Authoring: The WYSIWYG editor in Drupal to create and edit content in-place. 
     
  4. Content Revisioning and Workflows: For a distributed team Drupal enables a quick and easy way to track changes, revisions, and stage. It tells you who did what, when, out of the box. Also, it lets you manage custom, editorial workflows for all your content processes. Content staging allows you to track the status of the content - from creation to review to publication - while managing user roles and actions, automatically. 
     
  5. Content Tagging and Taxonomy: Beyond creating content, Drupal’s strength lies in creating structured content. This comes when you define content elements, tag content based on their attributes, create relevant taxonomy so it can be searched, found, used, and reused in ways that satisfy the visitors.
     
  6. Modules for Multimedia Content: Entity browser, paragraphs, pathauto, admin toolbar, linkit, blog, meta tag, and other content editing modules give the extra lease of life by extending and customizing content features and capabilities. They allow you to choose what features you want for your site. 

With multimedia content, your commerce-based site better serves the need for integrated, unified and hiccup-free user experience. In addition, you can also push content outside from your website to other channels.

As marketing horizons are expanding to social media it is important to deliver highly relevant and personal content via video (YouTube), stores, TV, etc. Brands no more can afford to continue to deliver disconnected and uncoordinated across a variety of different channels.

 

But Trust the Case Studies
  • Benefit


The new content-centric website is an integrated, robust online store managed with SAP Hybris and Drupal. As the marketing department’s needs became more sophisticated, the content management system offered by Hybris was no longer able to adequately manage the store’s front end and content experience. 

Benefit Cosmetics is known for their colorful personality, irreverent voice, and unique dilemma based shopping experience. And so is the content that mirrors the seamless provide a seamless shopping experience. Benefit’s marketing and content teams are now able to maintain the brand’s unique design aesthetic while customizing content for users’ needs. 

The new platform leveraged commerce for over thirty countries. To ensure the sanity of the translations workflow, with Translations.com.
 

  • Strand of Silk


Strand of Silk website required a smart blend of commerce and content, such that the content generated by the editor and user can be easily linked to the products on the website. 

Various other e-commerce only solutions were evaluated, but Drupal was selected because of the ability to easily combine e-commerce and content - a trend that was seen as the de-facto requirement in the near future for e-commerce sites. 

The Rise of Content, Commerce, and Conversation

Content and commerce were coming together for a long time. But conversational commerce is catching up really fast. For consumers, a conversational experience is a way for them to learn about the product and services.

Informal exchange of ideas by the spoken words. 

Shoppers are looking for easy interactions like conversations, which are also casual and convenient. Conversational commerce as it catches up will be the guiding experience moving forward. 

The idea of conversational UI, shouldn’t be limited to a chatbot. The old trick still works. Content still rules. Although the new techniques and technologies can change the way we are doing things we can’t abandon the channels.  

As messaging platforms have become so universal and common, they are also easy to build. 


There can be many ways the model works. It can be one-to-one and one-to-many. Sending messages to the customer who has applauded their service on Facebook, comes under the one-to-one approach. 

But if a new shopping store sends a custom message to a targeted audience segment living in the area it comes under the one-to-many approach.

Add to the scene, the boom of voice assistants. Amazon Alexa and Google Home do actually assist the consumer in finding products, stores, events and much more. 

The Drupal community has been focusing on the bot frameworks and other cognitive services that can be used to develop bots for different use cases.  it all started with a framework called Open Source Bot Builder SDK for Node.js which is used for building bots. 

Further several bot frameworks like Facebook Messenger (wit.ai), Google Dialogflow, IBM Watson, Microsoft Bot Framework and open source conversational AI like Rasa are considered for the integration. 

The main idea was that the bots will enable search and explore the products by incorporating Drupal Commerce APIs. On the basis of message-based interaction, bots can also enable simple Add To Cart and Review Cart functionality among others and can offer relevant actions while looking for a product.
 

Whatever perspective you acquire, integrating content into commerce is easier said than done. The product has to be worthy, content authentic, and the transaction without a breach. Providing a seamless experience to both retailers and publishers, Drupal is the bridge you need. 

Connect with us to build a seamless, content-commerce experience. Drop a mail at hello@opensenselabs.com.

blog banner blog image Commerce E-Commerce Content and Commerce User Experience Drupal 8 Blog Type Articles Is it a good read ? On

ComputerMinds.co.uk: Custom AJAX loading icon

18. Dezember 2018 - 12:48

There's nothing like Drupal's stock AJAX spinner (this:    Drupal's default blue loading throbber graphic) to make you notice that a site's design hasn't been fully customised. The code from my previous article showing how to fetch a link over AJAX to open in a Foundation reveal popup would suffer from this without some further customisation. After clicking the 'Enquire' button, a loading icon of some kind is needed whilst the linked content is fetched. By default, Drupal just sticks that blue 'throbber' next to the link, but that looks totally out of place. Our client's site uses a loading graphic that feels much more appropriate in style and placement, but my point is that you can set up your own bespoke version. Since it's Christmas, let's add some festive fun! Here's a quick video showing what I'll take you through making:

A few things are needed:

  1. Create a javascript method that will add a custom progress indicator
  2. Ensure the javascript file containing the method is included on the page
  3. Set a custom attribute on the link that will trigger the AJAX
  4. Override Drupal core's javascript method that adds the standard progress throbber, to respect that custom attribute

There are many ways to achieve points 1 and 2. Usually, you would define a library and add it with #attached. But I decided I wanted to treat my work as if it were part of Drupal's core AJAX library itself, rather than something to add separately. So I implemented hook_library_info_alter() in my theme's main .theme file:

/** * Implements hook_library_info_alter(). */ function MYTHEME_library_info_alter(&$libraries, $extension) { // Add our own extension to drupal.ajax, which is aware of the page markup so // can add AJAX progress loaders in the page. if ($extension == 'core' && isset($libraries['drupal.ajax'])) { $libraries['drupal.ajax']['js']['/' . drupal_get_path('theme', 'MYTHEME') . '/js/ajax-overrides.js'] = []; } }

My ajax-overrides.js file contains this:

(function ($, window, Drupal, drupalSettings) { /** * Creates a new Snowman progress indicator, which really is full screen. */ Drupal.Ajax.prototype.setProgressIndicatorSnowman = function () { this.progress.element = $(' '); // My theme has a wrapping element that will match #main. $('#main').append(this.progress.element); }; })(jQuery, window, Drupal, drupalSettings);

My theme happens to then style .ajax-progress-snowman appropriately, to show a lovely snowman in the middle of the page, rather than a tiny blue spinner next to the link that triggered the AJAX. Given that the styling of the default spinner happens to make links & lines jump around, I've got the ajax-progress-fullscreen class in there, to be more like the 'full screen' graphic that the Views UI uses, and avoid the need to add too much more styling myself.

Part 3, adding a custom attribute to specify that our AJAX link should use a Snowman animation, is easily achieved. I've already added the 'data-dialog-type' attribute to my link, so now I just add a 'data-progress-type' attribute, with a value of 'snowman'. I want this to work similarly to the $element[#ajax]['progress']['type'] property that can be set on form elements that use AJAX. Since that only gets applied to form elements, not arbitrary links using the 'use-ajax' class, we have to do the work to pick this up ourselves.

So this is the last part. Back in my ajax-overrides.js file, I've added this snippet to override the standard 'throbber' progress type that AJAX links would otherwise always use. It falls back to Drupal's original method when the progress type isn't specified in a 'data-progress-type' attribute.

// Override the progress throbber, to actually use a different progress style // if the element had something specified. var originalThrobber = Drupal.Ajax.prototype.setProgressIndicatorThrobber; Drupal.Ajax.prototype.setProgressIndicatorThrobber = function () { var $target = $(this.element); var progress = $target.data('progressType') || 'throbber'; if (progress === 'throbber') { originalThrobber.call(this); } else { var progressIndicatorMethod = 'setProgressIndicator' + progress.slice(0, 1).toUpperCase() + progress.slice(1).toLowerCase(); if (progressIndicatorMethod in this && typeof this[progressIndicatorMethod] === 'function') { this[progressIndicatorMethod].call(this); } } };

So there you have it - not only can you launch beautiful Foundation Reveal popups from links that fetch content via AJAX, you can now avoid Drupal's little blue throbber animation. If it's an excuse to spread some cheer at Christmas, I'll take it.

Happy Christmas everyone!

DrupalCon News: Community Connection - Mario Hernandez

18. Dezember 2018 - 10:11

We’re featuring some of the people in the Drupalverse! This Q&A series highlights some of the individuals you could meet at DrupalCon.

Every year, DrupalCon is the largest gathering of people who belong to this community. To celebrate and take note of what DrupalCon means to them, we’re featuring an array of perspectives and some fun facts to help you get to know your community.

Dries Buytaert: Relentlessly eliminating barriers to growth

18. Dezember 2018 - 5:11

In my last blog post, I shared that when Acquia was a small startup, we were simultaneously focused on finding product-market fit and eliminating barriers to future growth.

Today, Acquia is no longer a startup, but eliminating barriers to growth remains very important after you have outgrown the startup phase. In that light, I loved reading Eugene Wie's blog post called, Invisible asymptotes. Wie was a product leader at Amazon. In his blog post he explains how Amazon looks far into the future, identifies blockers for long-term growth, and turns eliminating these stagnation points into multi-decade efforts.

For example, Amazon considered shipping costs to be a growth blocker, or as Wie describes it, an invisible asymptote for growth. People hate paying for shipping costs, so Amazon decided to get rid of them. At first, solving this looked prohibitively expensive. How can you offer free shipping to millions of customers? Solving for this limitation became a multi-year effort. First, Amazon tried to appease customers' distaste for shipping fees with "Super Saver Shipping". Amazon introduced Super Saver Shipping in January 2002 for orders over $99. If you placed an order of $99 or more, you received free shipping. In the span of a few months, that number dropped to $49 and then to $25. Eventually this strategy led to Amazon Prime, making all shipping "free". While a program like Amazon Prime doesn't actually make shipping free, it feels free to the customer, which effectively eliminates the barrier for growth. The impact on Amazon's growth was tremendous. Today, Amazon Prime provides Amazon an economic moat, or a sustainable competitive advantage – it isn't easy for other retailers to compete from a sheer economic and logistical standpoint.

Another obstacle for Amazon's growth was shipping times. People don't like having to wait for days to receive their Amazon purchase. Several years ago, I was talking to Werner Vogels, Amazon's global CTO, and asked him where most commerce investments were going. He responded that reducing shipping times was more strategic than making improvements to the commerce backend or website. As Wie points out in his blog, Amazon has been working on reducing shipping times for over a decade. First by building a higher density network of distribution centers, and more recently through delivery from local Whole Foods stores, self-service lockers at Whole Foods, predictive or anticipatory shipping, drone delivery, and more. Slowly, but certainly, Amazon is building out its own end-to-end delivery network with one primary objective: reducing shipping speeds.

Every organization has limitations that stunt long-term growth so there are a few important lessons that can be learned from how Amazon approached its invisible asymptotes:

  1. Identify your invisible asymptotes or long-term blockers for growth.
  2. Removing these long-term blockers for growth may look impossible at first.
  3. Removing these long-term blockers requires creativity, patience, persistence and aggressive capital allocation. It can take many initiatives and many years to eliminate them.
  4. Overcoming these obstacles can be a powerful strategy that can unlock unbelievable growth.

I spend a lot of time and effort working on eliminating Drupal's and Acquia's growth barriers so I love these kind of lessons. In a future blog post, I'll share my thoughts about Drupal's growth blockers. In the meantime, I'd love to hear what you think is holding Drupal or Acquia back — be it via social media, email or preferably your own blog.

Promet Source: How to Stop SPAM with Drupal 8's Recaptcha module

18. Dezember 2018 - 3:43
Have you ever tried logging in or registering to a website and you were asked to identify some distorted numbers and letters and type it into the provided box? That is the CAPTCHA system. The CAPTCHA helps to verify whether your site's visitor is an actual human being or a robot. Not a robot like you see in the Terminator movie but an automated software to generate undesired electronic messages (or content). In short, CAPTCHA protects you from SPAM.  

Flocon de toile | Freelance Drupal: Small sites, large sites, micro sites with Drupal 8

18. Dezember 2018 - 3:04

Drupal 8 is a tool designed to meet the needs of the most ambitious web projects. We hear a lot about the notions of headless, API first, decoupling, etc. that resolutely allow solid architectures for ambitious projects. But this does not mean that Drupal 8 no longer propels more traditional, and sometimes even much less ambitious sites: simple, small, and even large, websites, but for which we want to benefit from the modularity, flexibility and robustness of Drupal.

Gábor Hojtsy: How to automate testing whether your Drupal 8 module is incompatible with Drupal 9?

17. Dezember 2018 - 20:23

Drupal 9 is planned to be only 18 months away now, wow! It is already being built in Drupal 8 by marking APIs to be removed in Drupal 9 as deprecated and eventually upgrading some dependency version requirements where needed. Once the Drupal 9 git branch will be open, you will be able to test directly against Drupal 9. That should not stop you from assessing the compatibility of your module with Drupal 9 now. To prepare for compatibility with Drupal 9, you need to keep up with deprecated functionality and watch out for upgraded dependencies (when we know which are those exactly). Of these two, automation can go a long way to help you keep up with deprecated APIs.

DrupalCon News: DrupalCon Seattle: Sessions and Strides

17. Dezember 2018 - 20:10

DrupalCon Seattle is looking different than the DrupalCons of years past.

The overarching goal when planning DrupalCon Seattle 2019 was to expand both outreach and accessibility so that attendees would be representative of the community as a whole. The value of the conference is in the perspectives, energy and diversity of experiences participants share.

DrupalCon began setting goals to overtly increase diversity starting with DrupalCon Baltimore 2017. This continued in the planning of DrupalCon Nashville 2018, and is prioritized for DrupalCon Seattle 2019.

MidCamp - Midwest Drupal Camp: Summits: What to Expect?

17. Dezember 2018 - 19:37
Summits: What to Expect?

This year MidCamp will be including summits in addition to the regular programming that we have provided in the future. Here are some things we think you should know in order to prepare yourself:

A summit is a one-day topic-intensive meeting where people who share an industry or interest can come together to collaborate, share pain points and solutions, and meet like-minded individuals in a structured, safe environment.

Summits focus a full day unconference around a singular topic, in which different groups of interested parties collaborate, gather information and learn together. This programming is for focused discussion, planning, hacking and learning about the topic. 

We believe in facilitating like an unconference. On the day of, each summit group led by a facilitator will compile an agenda and create breakout groups on various subtopics of the overall summit topic.

Unlike training, attendees are generally still planning and information gathering. There won’t be any required deliverable, like code or documentation. Instead, summits focus on conversation and dialog. During a training, the focus is learning a thing, but summits encourage open idea sharing on a broad range of topics related to the overall theme. 
 

Takeaways from the Midcamp Team

Below are some stories from our team as they reflect back on their first summit.

“I felt like I was in a room full of rock stars. Angie Byron, Sam Boyer, Chris Vanderwater... I forget who else, but there were a fair number of big names. We were there to discuss the panels/blocks initiative. There was considerable brainstorming on various problems that were currently being solved in the initiative.”

- Andrea Soper

“I just attended my first summit at BADCamp this year. It was the front end summit and attendees were polled ahead of time to get an overall sense of what front end topics people were interested in discussing. At the summit, we used that list and then added to it via post-its to organize the topics into larger categories. Then throughout the day, we broke into smaller groups to discuss almost every topic that came up. The facilitators were good about keeping the discussion moving along and ensuring we covered everything. The day was also broken up with some fun group icebreakers and a talk from one of the creators of GatsbyJS.”

- Kevin Thull

DrupalEasy: DrupalEasy Podcast 213 - Ted Bowman - Layout Builder in Core

17. Dezember 2018 - 16:33

Direct .mp3 file download.

Ted Bowman, senior software engineer with the Drupal Acceleration Team at Acquia, joins Mike to discuss the game-changing work of the Layout Initiative. Sorry about the poor quality of part of Mike's side of the conversation (as well as the comical overdubbing of other portions of the conversation).

Discussion DrupalEasy News Upcoming Events Sponsors Follow us on Twitter Subscribe

Subscribe to our podcast on iTunes, Google Play or Miro. Listen to our podcast on Stitcher.

If you'd like to leave us a voicemail, call 321-396-2340. Please keep in mind that we might play your voicemail during one of our future podcasts. Feel free to call in with suggestions, rants, questions, or corrections. If you'd rather just send us an email, please use our contact page.

OpenSense Labs: Breaking Down the Concept of Distributed Content Management System

17. Dezember 2018 - 16:10
Breaking Down the Concept of Distributed Content Management System Akshita Mon, 12/17/2018 - 19:40

Heading a multinational or location agnostic organization with complex content creation and publication needs while also keeping a track of the content can be a difficult task without the right content management system.

The number of bloggers is expected to reach 31.7 million in 2020 in the US alone. 

Imagine the number of blogs on the internet. The huge amount of information flowing online has brought us to the situation where the ever-flowing media content needs to be routinely stored and encoded. Networked storage and exchange of data allow content to be distributed making the task of content management all but impossible to deal, without a content management system.

Content and teams that interact in a distributed system need to be dealt intrinsically different from the ones that interact in a centralized system.

Considering the popularity of Drupal as the enterprise’s CMS, in this blog, we will explore how it can help in providing and managing the modern digital experience as a Distributed Content Management System.

 

Understanding the Concept

A distributed content management system can be difficult to comprehend to different people as it implies a different meaning to a different situation. 

To develop a better understanding of the distributed content management system, let’s understand with an example of a national daily which also publishes in different regional languages. 

The Distributed Management of Content or The Management of Distributed Content

The Distributed Management of Content deals with the workflow involved in the content creation with a decentralized approach. 

The Management of Distributed Content works around dealing with existing content from a variety of sources, involving input (from other websites/sources), output (to other websites) or both. 

By implementing Distributed Management of Content, organizations can eliminate the time and opportunity for error introduced when users enter content in multiple places. Unlike the first concept, the goals for Management of Distributed Content are generally around efficiency and control. 

Setting up An Example of a National Media House

Let’s call this media house - OneIndia News

One India news has 6 regional websites. Similar to many media institutions, the website channels are split into multiple categories (let’s say 5) and each of those categories further houses a number of sub-sections.  

Some of the regional websites may only have 2 to 4 categories depending on the demand, but others may have upwards of 10. 

Each category has an editorial team of its own.

Now the regional websites are handled by a number of different editors for each category and channel. Toss in the requisite assortment of content types and workflow hierarchy - you can see how quickly the web presence gets complex!  

Management of distributed content revolves around efficiency and control.

At this scale, we’re likely dealing with multiple websites of one media organization, all of which have requirements around content. This has now become the perfect use-case for Distributed Content Management!

  Use Case 1: Publishing Workflows For Individual Websites

For the main website of One India News, a central editorial team with defined roles and distributed content production would suffice.

Consideration of a content approval workflow is a critical part of the content strategy for any organization that employs distributed management.

Each news needs to be added and edited by different people. Editing the news on the live site can result in accidental publishing.

Be it living a number of articles at the same time, sending the final copy for the approval of different persons (without living them) or publishing articles on different subdomains. A robust virtual workflow and content staging and publishing without the requiring the editor to log into the target site is needed from the CMS. 

Publishing workflows will be tailored not only to the regional media house but to each channel and team that’s in charge of their regional website. The idea here is to manage the responsibilities across the organization while empowering the editors. 

Content to be published on the homepage of the website will likely require significantly more oversight than in the humor or offbeat channel. 
 

Use Case 2: Sharing Content Out - Centralized Content On A Distributed Web Platform

Copy-and-paste becomes a less efficient option when the content is further distributed to the workflow.

A distributed system must have a Pub-Sub (Publisher-Subscriber) feature to ensure the information is processed quickly across the different systems. The centralized system must allow editing and processing of the data while pushing the request to the subsystems. This needs to be done asynchronously so the results populate really fast, for the editor. 

Use Case 3: Sharing Content In - Decentralized Websites As Points Of Origin

Another interesting use case presents itself when we consider distributed websites as the starting point for content creation. One India, as any media houses maintain a central calendar of events, such as festivals and political events. 

In a well-formed distributed content model, with an appropriate CMS like Drupal, the same metadata that allows visitors to filter events - audience, department, program - can be easily used to syndicate those events to various other websites.  

Unfortunately, the same level of consideration is not always given to everyone outside the subset team with appropriate permissions. 

Content managers who are generally empowered to manage their own content may not have the same access to do so, or, in cases where they do have permission, find themselves needing to enter content into an entirely different website system to get it published to their site. But why should this be the case?  

By extending the same technologies that allow websites to receive events from a central calendar, in Drupal we can enable content managers to publish events to the calendar from within the same website they usually manage. (The same content approval and publishing workflow considerations apply, of course.)
 

Difference between Centralized and Distributed Content Management
 

Centralized Content Management

Distributed Content Management 

  • All content funneled through one group

  • Small individual workgroups responsible for respective areas

  • Central rules and procedures to ensure rules are followed 

  • The responsibility of individual groups to oversee content quality

  • One person authority - who is responsible for the rules and implementation

  • Each group may have one or more lead approvers. Workgroups leads handle process and rules

  • Advantage - Resulting process control without confusion

  • Advantage - Responsibility and the workload are distributed

  • Disadvantage - May result in a bottleneck

  • Disadvantage - Individual groups can interpret rules differently


Use Case 4: Multichannel Brand Content

Single-source content syndication also provides an opportunity for media companies to promote their brand across multiple mediums. Many companies choose to employ standalone, all-in-one news providers such as Reuters, rather than integrating a category for each of the news providers. 

This makes a tremendous amount of sense - these organization systems when merged with the own CMS can provide a number of compelling results such as quicker results and faster news publishing. 

By programmatically receiving the content from a content repository the organization can eliminate the risk of delayed news and perpetual loss of audience. 


Use Case 5: Content Delivery To Validated Audiences

In an attempt to decentralize content over the years, media organizations now allow users to add stories to the website. 

How they access, validate, identify the users is another key consideration for the company’s distributed content management strategy. 

A common approach is to segregate guest editor content into different regional “portals” - websites that require the editor to create accounts and login to see the information for their country or part of the world.  

To overcome the challenge of validating these accounts, companies often integrate with an Identity Provider (IdP) such as SAML 2.0 Single Sign On easy configuration & active support, in your Drupal website. 

At the far end of the Distributed Content Management spectrum are systems that need to publish consistent, controlled content to websites with no possibility for discrepancies across multiple sites.  

Drupal allows Distributed Content Management strategy to be applied to large volumes of content to facilitate efficient workflow. Specifically, the system allows different content and editors to be part of the same system without much replication. 

Finally, the modular design of the Drupal architecture allows both stand-alone and distributed realizations so that the system can be deployed in a variety of applications. Connect with us, drop a mail at hello@opensenselabs.com or tweet us @OpenSenseLabs

blog banner blog image Content Management System Distributed Management of Content Content sharing Decentralized Websites Drupal CMS Content Creation Content Marketing Distributed content management Blog Type Articles Is it a good read ? On

OpenSense Labs: Important OOP Concepts For Drupal Developers To Create Custom Modules

17. Dezember 2018 - 15:38
Important OOP Concepts For Drupal Developers To Create Custom Modules Vasundhra Mon, 12/17/2018 - 19:08

Modifying existing code might be all fun and games for a developer, but what about the time when you have to venture out to unknown shores and create your own custom modules? 

Scary, right? 

But you shouldn’t fear because Drupal 8 is here.

Drupal 8 uses a PHP framework called Symphony which relies heavily on Object-oriented programming.

It has been granting its users with benefits like code reuse and encapsulation, and these benefits allow users to maintain and structure code in a better way possible. 


Phew! 

However, this might leave you with a farrago of questions - What do I need to know in Drupal 8 to start developing? What is OOP? Why is it used in Drupal 8 to make modules? How does it create the custom modules? 

Thus, here is how you can do it all that might help make the OOP principle of PHP a little less daunting. 

Start With Prerequisites to Create Custom Modules

We all know that Object Oriented Programming has provided us with the power to create our desired objects and construct methods to handle them. And with the usage of various OOP principles and design patterns, Drupal 8 has brought about a much easier path in terms of development.  

Drupal 8 serves as a great introduction to PHP. Here are some of the design patterns which are important to understand to solve the basic object-oriented design problem. 

PHP Namespace (introduced in version 5.3)

In PHP you can’t have two classes that deal with the same name (they have to be unique). Therefore, PHP namespace allows you to dodge this issue by presenting a similar code into neat little packages, or even to determine ownership.

Drupal 8 consists of a number of files that declare the namespace in order to remain compatible with PHP 5.3. Therefore, with the help of two standards in Drupal, PHP interfaces and traits are easily namespaced.

Use statement

Classes and interfaces with a (\) backslash inside their fully qualified name should not use it inside the core. If it differs from the current file, then it can be solved by using the “use” statement on the top. For example

namespace Drupal\mymodule\Tests\Foo; use Drupal\simpletest\WebTestBase; /** * Tests that the foo bars. */ class BarTest extends WebTestBase {


And, for the file which does not declare a namespace has to specify with the use statement at the top of the file 
For the classes that are without backslash, they must be fully qualified when used in the namespace file.

Also, while you are importing a class with “use”, do not use the backslash. 

Aliasing the class 

PHP has allowed the classes to be aliased when they are being imported into a namespace. It is done to avoid the collision. But suppose the collision still happens, you can alias the classes by prefixing the next higher portion of the namespace.

use Foo\Bar\Baz as BarBaz; use Stuff\Thing\Baz as ThingBaz; /** * Tests stuff for the whichever. */ function test() { $a = new BarBaz(); // This will be Foo\Bar\Baz $b = new ThingBaz(); // This will be Stuff\Thing\Baz } Dependency Injections

Dependency Injections is that software design pattern that would allow you to remove hard-coded dependencies and also make it possible to change them either on runtime or at compile time.

Drupal 8 introduced the concept of services (object managed by service container) in order to decouple reusable functionalities. It creates the services pluggable and replaceable by registering them with the help of a service container.

These services are used to perform operations that include accessing of the database or sending up of an e-mail. Therefore, to let the code simply access the database (without worrying about whether the database is MySQL or SQLite), usage of core provided service via the service container is done.

These core services are defined in CoreServiceProvider.php and core.services.yml. Somewhat like:

... language_manager: class: Drupal\Core\Language\LanguageManager arguments: ['@language.default'] ... path.alias_manager: class: Drupal\Core\Path\AliasManager arguments: ['@path.crud', '@path.alias_whitelist', '@language_manager'] ... string_translation: class: Drupal\Core\StringTranslation\TranslationManager ... breadcrumb: class: Drupal\Core\Breadcrumb\BreadcrumbManager arguments: ['@module_handler'] ...


Each service depends on the other service. Like in the example above path.alias_manager is dependent on the path. crud, path.alias_whitelist and language_manager services specified in the arguments list.

Dependency injection is the preferred procedure for accessing and using services in Drupal 8. Services are transferred as an argument to the container or injected via setter methods.

Symfony 

Symfony is a PHP framework that Drupal borrows from in order to reduce codes duplication across various PHP projects. Much of the code that Drupal 8 uses to handle routing, sessions, and service container. These components are flexible and universal solutions. They are the stable ones and solves most the problems that aren’t good practice, to reinvent the wheel. Symfony follows the standards that adhere to PSR-5 and PSR-7

Annotations

Annotations are the comments in your code that contain meta information. The main advantage of annotations is that they improve performance due to the less memory usage and is placed in the same files as the class is. For example

/** * Provides a 'Custom' Block * * @Block( * id = "custom_block", * admin_label = "Custom block", * ) */


Drupal 8 uses PHP annotations for plugin discovery and to present additional context/meta-data for the codes that have to be executed. These are the read using Doctrine annotation parser (offers to implement custom annotation functionality for PHP classes.) and then they are turned into information that Drupal can use for better understanding on what your code is actually doing. 

Plugins 

Plugins are considered as a small piece of functionalities that can be swapped. Drupal consists of different plugins with different types. The CMS platform provides a set of guidelines and reusable code components that allows the developer to expose pluggable components within their code and manage these components with the user interface. Plugins have three basic elements namely.

Plugin type: It is a central controlling class that would define how the plugin of this type will be discovered and instantiated.

Plugin Discovery: It is the process of finding plugins within the code base that is qualified for the usage.

Plugin Factory: It is responsible for instantiating specific plugins.

Not to Forget the OOP Coding Standards 

If the end user is aware of key OOP principle and design pattern, then it becomes even more easy for them to use it with Drupal. For instance, different services become available when default container initializes while bootstrapping Drupal. In short, you have the power to build your own class, then define it as a service and make it available in the container. 

Drupal 8  has a set of coding standards just for object-oriented code and adheres to common PHP coding conventions. 

Thus, some of the common PHP conventions for OOP that Drupal follows for best practices would include:

  • Declaring a class in OOP. It is important that there should always be one interface or trait per file. The classes are autoloaded based on PSR-4 namespacing convention, and in the core, the tree under PSR-4 starts as core/lib/. For the modules that contain contrib, custom and those in the core, the PSR-4 tree starts under modulename/src. It should also be noted that it is only possible to define a class in a module if the class does not contain any superclass. 
  • Next in this coding standards would be whitespace or indentation method. Both of them leave an empty line between the start of the class definition and property definition. Just like this:
class GarfieldTheCat implements FelineInterface { // Leave an empty line here. public function meow() { ... ... ...

 For an empty space between property definition and method definition:

... ... ... protected $lasagnaEaten = 0; // Leave an empty line here. public function meow() { return t('Meow!'); }

And then for the space between the end of method and end of the class definition:

class GarfieldTheCat implements FelineInterface { ... ... ... public function eatLasagna($amount) { $this->lasagnaEaten += $amount; } // Leave an empty line here. }
  • Without basic naming conventions, coding standard for OOP is a void. These naming conventions (set of rules) would help you to choose the character sequence to be used for the identifier that denotes the variables, functions, types and other entities.  
  • There might be chances where you would also wish to extend your code. Thus the use of separate interface definition would help you by contributing highly in terms of flexibility and would also neatly centralizes the document, making it easier to read.  A class that has to be extended must always provide an interface that other class can implement rather than forming them to extend the base class.
  • Also, it is important for all the methods and properties of classes to specify the visibility (private, protected or public). The use of public properties is strongly discouraged. It allows the entry of unwanted side effects and exposes implementation specific details, which in turn makes swapping out of class (for another implementation) much more hard. 
  • Now comes the “Type Hinting” in PHP. It is basically used to specify the expected data type of an argument in a function declaration.  Although type hinting is optional, it is recommended for debugging.If an object of the incorrect type is passed, an error is shown. If the method’s parameter expects a certain type of interface, it is important to specify it. This would guarantee that you are checking for a type and also maintaining a fluid code.
  • Next is instantiation. It is basically the creation of a real instance or a single realization of an abstraction/template such as the class of object. Drupal coding standards look down upon directly creating classes. Rather it is better to create a function to instantiate the object and return it. It is because:
  1. The function which is written can be reused to return different objects with the same interface as it is needed. 
  2. You are not allowed to chain construct in PHP, but you are allowed to chain return object from the function. 
  • Last but not the least - Chaining.  Chaining is that blessing for you which allows you to immediately call a function on a return object. This is also known as “fluent interface”
// Unchained version $result = db_query("SELECT title FROM {node} WHERE nid = :nid", array(':nid' => 42)); $title = $result->fetchField(); // Chained version $title = db_query("SELECT title FROM {node} WHERE nid = :nid", array(':nid' => 42))->fetchField();

A method would return $this, and then would be chainable in a case where there is no other logical return value.

In cases that have a fluid interface of the classes, and code span of more than one line, the method calls should attend 2 spaces

$query = db_select('node') ->condition('type', 'article') ->condition('status', 1) ->execute(); Routing in Drupal 8 is Equally Important 

Drupal 8 routing system works with the Symfony HTTP kernel. The routing path has replaced hook_menu() in Drupal 7. Though in Drupal 8 heavy use of Symphony 2 components handle the routing part. Drupal 8 also uses YAML format. All the information about routes of a module is kept in the file MODULE_NAME.routing.yml. 

The routing system is responsible for matching paths to the controller and then you are allowed to those relations in routes. The additional information can also be passed to controllers in the router. 

Each route has to be described separately from one another with the involvement of these characteristics :

  • Name for identifying the routes 
  • Path beginning with a slash
  • A route’s processor
  • Condition managing the access to the route
example.my_page: path: '/mypage/page' defaults: _controller: '\Drupal\example\Controller\ExampleController::myPage' _title: 'My first page in Drupal8' requirements: _permission: 'access content'

Example.my_page is the route in the .routing.yml file. The route is the Symfony component which maps the HTTP request to set the configuration variable. Under path, we specify the path where route should be registered. This acts as the URL to route 

Creating “Controller Class”

It is important to build the ModuleController.php according to the PSR-4 naming standard. You just have to create a folder along with a file name with the following content. 

<?php /** * @file * @author Rakesh James * Contains \Drupal\example\Controller\ExampleController. * Please place this file under your example(module_root_folder)/src/Controller/ */ namespace Drupal\example\Controller; /** * Provides route responses for the Example module. */ class ExampleController { /** * Returns a simple page. * * @return array * A simple renderable array. */ public function myPage() { $element = array( '#markup' => 'Hello world!', ); return $element; } } ?>

A controller is a type of PHP function that you create. It takes the information from the HTTP request and creates or responds to an HTTP response.

Creating the “.module file”

In Drupal 8 hook_menu() is used to only define items. If you have a hook_menu() then make sure that route and path in example.module should match with example.routing.yml.

In the case of items and route example, .module should be on the same path.

<?php /** * @File * Example custom module for Drupal 8. * @author Rakesh */ /** * Implementing hook_menu(). */ function example_menu() { // The paths given here need to match the ones in example.routing.yml exactly. $items['/mypage/page'] = array( 'title' => 'First page', 'description' => 'This is a example page.', // The name of the route from example.routing.yml 'route' => 'example.my_page', ); return $items; } Conclusion

So here it is. Now, you know the concepts of OOP to create a custom module. Yes, it is important to know OOP, design patterns, Twig, and modern PHP trends for creating the modules, and Drupal makes this task even more easy for you. Isn’t it?

If you’re looking for more good resources and reference material, head over to OpenSense labs, where we provide services that develop complex web applications with relative ease. Whether it is the development of a new custom module or optimization of your new website, everything is handled and tailored according to your needs. 

So contact us at hello@opensenselabs.com for more information and reference on the same. 

blog banner blog image Drupal Drupal 8 Drupal Modules Object Oriented Programming Symfony PHP PHP Namespace Dependency Injections Annotations Plugins Chaining Routing Coding Standards design patterns Blog Type Tech Is it a good read ? On

CTI Digital: 10 Books Every Drupal Developer Should Read

17. Dezember 2018 - 13:45

Drupal is an enormously welcoming community with countless online forums and community events to learn about the platform. Its open-source knowledge sharing and peer review is arguably second-to-none, and thanks to Acquia's Drupal certifications the Drupal learning process is becoming more consolidated.

Yuriy Gerasimov: Automating checking your Drupal's updates

17. Dezember 2018 - 1:24

Drupal updates can be very different. Some of them -- easy patches that you just roll out and forget. Some of them -- break your site. Tricky part is you never know how updates will behave on your site until you actually tried them out.

This is why it is very tricky to give estimates to clients how long it is going to take. They usually do not appreciate answer 1 to 20 hours depending on some random facts.

In this way rolling out updates got delayed and delayed. And then we get to situations after half a year or a year that we know for sure site will be broken after updates. And now hero time begins.

Would it be nice if site would tell you not only the fact that it needs updates but also if it is going to break or not after rolling them out.

Nowadays, thanks to Pantheon's multidev, it is technically possible to automate checking how your updates will behave on the site.

Main idea is to regularly check updates (using drush command) then if updates are found create a separate environment and roll updates there. Afterward to ensure that they didn't break the site (at least visually) we could run some visual regression testing. So in result we have way more predictable answer about "how much efforts it will take to roll updates out".





Here is a full article tutorial about how to set it up http://docs.diffy.website/tutorials/put-your-sites-updates-on-autopilot-with-pantheon-multidev-and-visual-testing.

For sure fixing smaller updates is much easier than fixing big break after year of delays.

Tags: drupal planetdrupal 8

Dries Buytaert: Optimizing your product strategy for the short- and long-term

16. Dezember 2018 - 23:49

Most products cycle through the infamous Innovation S-curve, which maps a product's value and growth over time.

Startups are eager to find product-market fit, the inflection point in which the product takes off and experiences hockey-stick growth (the transition from phase one to phase two).

Just as important, however, is the stagnation point, or the point later in the S-curve when a product experiences growth stagnation (the transition from phase two to phase three). Many startups don't think about their stagnation point, but I believe they should, because it determines how big the product can become.

Ten years ago, a couple years after Acquia's founding, large organizations were struggling with scaling Drupal. I was absolutely convinced that Drupal could scale, but I also recognized that too few people knew how to scale Drupal successfully.

Furthermore, there was a lot of skepticism around Open Source scalability and security. People questioned whether a community of volunteers could create software as secure and scalable as their proprietary counterparts.

These struggles and concerns were holding back Drupal. To solve both problems, we built and launched Acquia Cloud, a platform to build, host, and manage Drupal sites.

After we launched Acquia Cloud, Acquia grew from $1.4 million in bookings in 2009 to $8.7 million in bookings in 2010 (600% year-over-year growth), and to $22 million in bookings by 2011 (250% year-over-year growth). We had clearly found product-market fit!

Not only did it launch Acquia in rocket-ship growth, it also extended our stagnation point. We on-boarded many large organizations and showed that Drupal can scale very large. This helped unlock a lot of growth for both Drupal and Acquia. I can say with certainty that many large organization that now use Drupal would not have adopted Drupal without Acquia.

Helping to grow Drupal — or extending Drupal's stagnation point — was always part of Acquia's mission. From day one, we understood that for Acquia to grow, Drupal had to grow.

Launching Acquia Cloud was a great business decision for Acquia; it gave us product market fit, launched us in hockey-stick growth, but also extended our S-curve.

As I think about how Acquia has approached the Innovation S-curve, a few important lessons stand out. My recommendation is to focus on opportunities that accomplish two things:

  • Focus on business opportunities that serve a burning customer need that can launch or accelerate your organization.
  • Focus on business opportunities that remove long-term barriers to growth and push out the stagnation point.

OpenSense Labs: Cooking Drupal-based platform for food lovers

16. Dezember 2018 - 20:20
Cooking Drupal-based platform for food lovers Shankar Sun, 12/16/2018 - 23:50

Cooking something very delicious requires the right sort of ingredients and preparation. Serving delectable food can entice people and make them remember the taste for a long long time. Building a food-based website also requires the right platform that can engage people and offer ambitious digital experiences. This is where Drupal enters the scene.


As an open source CMS, Drupal is a reliable, secure and flexible platform and helps in creating the features that technology professionals want. It conforms with technical and business requirements and can be a great solution for powering the online presence of a food-based brand.

Drupal’s Greatness for Food-based Website

Drupal powers websites of some of the great names in the food industry like BBC Good Food, 24 Kitchen, Bosscaffe, Alevri among others. What prompts them to choose Drupal?

Drupal powers websites of some of the great names in the food industry Spectacular functionalities

Drupal offers a lot of modules, themes, and distributions that can help build a great food-based website.

For instance, a restaurant chain can use the make their Drupal website stylish with a free mobile-first, Bootstrap 3 based theme for Drupal called Restaurant Lite.

You can even leverage the benefits of Restaurant Zymphonies Theme which is another free mobile-first theme that can power the websites of restaurants, food stalls, hotels and other dining websites.

As a multifunctional, commercial profile created for intricate online stores, Food Delivery, a Drupal distribution, offers a complete starter pack for developing food-based websites.

Security

Drupal Security Team has been working round-the-clock validating and responding to security issues thereby making it one of the most secure open source CMS. Among the leading open source CMSs, it has been performing far better than Wordpress, Joomla and Magento.

Drupal is one of the most secure open source CMS Source: Alert LogicScalability

To help you cope with the busiest of days, Drupal can scale with your needs and can efficaciously handle a massive amount of traffic.

Multilingual

Drupal has out of the box support for building multilingual websites in the form of core modules that allows you to deliver localised digital experiences.

Mobile-responsive

Drupal helps in building responsive sites and web applications thereby allowing you to interact with your consumers on-the-go.


Speed

To run an agile team and ensure the continuous delivery of the web development project, Drupal’s pliable platform is superb. Furthermore, it helps in implementing performance optimisation techniques for building a high performing site.

Third-party integration

You can leverage the best tools outside the periphery of Drupal by integrating a variety of marketing technologies and business applications.

Content Workflow

Content authors can get awesome tools for creating and publishing content on the site. With the help of its preview feature, you can see how your content will look across various devices. Moreover, the authentication and permissions enhance the editorial workflow.

Content authors can get awesome tools for creating and publishing content on the site
Content architecture

Drupal lets you create the right content architecture and show appropriate content for each context with the help of great display mode tools, Views and a plentitude of media types.


Content-as-a-service

Its content as a service approach lets the front end developers build engaging customer experiences with Drupal’s presentation neutral content and RESTful API leveraging tools like Angular, Ember, Backbone and many more.

Multisite

Drupal’s immense capability in building a multisite architecture allows you to govern multiple websites across your enterprise brands, geographies and promotional campaigns on a  centralised platform.

Business-driven

You can build a solution that adheres to your business requirements and does things as your business demands.

Perfect tech stack

Drupal dwells on a modern LAMP technology stack comprising of Linux, Apache, MySQL and PHP which helps in fulfilling the needs of fast-moving, flexible, and agile enterprises in creating ambitious digital experiences.

Large community

Drupal’s vast community presence is one of its greatest strength as thousands of organisations create solutions with Drupal and in the process build Drupal itself.


Case study

24 Kitchen, one of the most popular platforms on food, cooking and lifestyle, has extracted the power of Drupal with the help of a digital agency to transform their presence in the digital landscape.

Search API Solr Search, a Drupal module for offering Solr backend, uses Apaches Solr servers for indexing and searching content and was utilised for related recipes in 24 Kitchen website development. The amazing capabilities of Fast Autocomplete module merged the extensive database of videos with the recipe’s database thereby allowing the retrieval of thousands of recipes that come with recommendations based on preference and user parameters.

Without any developer’s interference, the content editor could create flexible layout components, new pages and formats. This was made possible by paragraphs module. Through smart widgets, high-value content was disclosed which allowed other websites to directly query and present content from the 24 Kitchen within their own website. 

The Drupal website of 24 Kitchen has been very advantageous for marketing and sales with its boundless integration with the 24 Kitchen television format. It has paved the way for working with partners on promotional campaigns and cross-selling via numerous national news and lifestyle sites. The Drupal-powered website made it possible for content syndication and serving content to the consumers when relevant (for example, the Widgets and Facebook recipe bot). Ultimately, the redressal of 24 Kitchen website with the help of Drupal’s monumental capabilities resulted in staggering growth in page views.

Conclusion

Drupal offers a stupendous platform for building a powerful food-based website and allows the enterprises to grow as a brand.

We love Drupal and have been in our constant pursuit of delivering high quality and innovative solutions with our expertise in Drupal development.

Contact us at hello@opensenselabs.com to build a food-based site using Drupal.

blog banner blog image Blog Type Articles Is it a good read ? On