Drupal

Dries Buytaert: Distributions remain a growing opportunity for Drupal

Planet Drupal - 14 February 2017 - 11:40am

Yesterday, after publishing a blog post about Nasdaq's Drupal 8 distribution for investor relations websites, I realized I don't talk enough about "Drupal distributions" on my blog. The ability for anyone to take Drupal and build their own distribution is not only a powerful model, but something that is relatively unique to Drupal. To the best of my knowledge, Drupal is still the only content management system that actively encourages its community to build and share distributions.

A Drupal distribution packages a set of contributed and custom modules together with Drupal core to optimize Drupal for a specific use case or industry. For example, Open Social is a free Drupal distribution for creating private social networks. Open Social was developed by GoalGorilla, a digital agency from the Netherlands. The United Nations is currently migrating many of their own social platforms to Open Social.

Another example is Lightning, a distribution developed and maintained by Acquia. While Open Social targets a specific use case, Lightning provides a framework or starting point for any Drupal 8 project that requires more advanced layout, media, workflow and preview capabilities.

For more than 10 years, I've believed that Drupal distributions are one of Drupal's biggest opportunities. As I wrote back in 2006: Distributions allow us to create ready-made downloadable packages with their own focus and vision. This will enable Drupal to reach out to both new and different markets..

To capture this opportunity we needed to (1) make distributions less costly to build and maintain and (2) make distributions more commercially interesting.

Making distributions easier to build

Over the last 12 years we have evolved the underlying technology of Drupal distributions, making them even easier to build and maintain. We began working on distribution capabilities in 2004, when the CivicSpace Drupal 4.6 distribution was created to support Howard Dean's presidential campaign. Since then, every major Drupal release has advanced Drupal's distribution building capabilities.

The release of Drupal 5 marked a big milestone for distributions as we introduced a web-based installer and support for "installation profiles", which was the foundational technology used to create Drupal distributions. We continued to make improvements to installation profiles during the Drupal 6 release. It was these improvements that resulted in an explosion of great Drupal distributions such as OpenAtrium (an intranet distribution), OpenPublish (a distribution for online publishers), Ubercart (a commerce distribution) and Pressflow (a distribution with performance and scalability improvements).

Around the release of Drupal 7, we added distribution support to Drupal.org. This made it possible to build, host and collaborate on distributions directly on Drupal.org. Drupal 7 inspired another wave of great distributions: Commerce Kickstart (a commerce distribution), Panopoly (a generic site building distribution), Opigno LMS (a distribution for learning management services), and more! Today, Drupal.org lists over 1,000 distributions.

Most recently we've made another giant leap forward with Drupal 8. There are at least 3 important changes in Drupal 8 that make building and maintaining distributions much easier:

  1. Drupal 8 has vastly improved dependency management for modules, themes and libraries thanks to support for Composer.
  2. Drupal 8 ships with a new configuration management system that makes it much easier to share configurations.
  3. We moved a dozen of the most commonly used modules into Drupal 8 core (e.g. Views, WYSIWYG, etc), which means that maintaining a distribution requires less compatibility and testing work. It also enables an easier upgrade path.

Open Restaurant is a great example of a Drupal 8 distribution that has taken advantage of these new improvements. The Open Restaurant distribution has everything you need to build a restaurant website and uses Composer when installing the distribution.

More improvements are already in the works for future versions of Drupal. One particularly exciting development is the concept of "inheriting" distributions, which allows Drupal distributions to build upon each other. For example, Acquia Lightning could "inherit" the standard core profile – adding layout, media and workflow capabilities to Drupal core, and Open Social could inherit Lightning - adding social capabilities on top of Lightning. In this model, Open Social delegates the work of maintaining Layout, Media, and Workflow to the maintainers of Lightning. It's not too hard to see how this could radically simplify the maintenance of distributions.

The less effort it takes to build and maintain a distribution, the more distributions will emerge. The more distributions that emerge, the better Drupal can compete with a wide range of turnkey solutions in addition to new markets. Over the course of twelve years we have improved the underlying technology for building distributions, and we will continue to do so for years to come.

Making distributions commercially interesting

In 2010, after having built a couple of distributions at Acquia, I used to joke that distributions are the "most expensive lead generation tool for professional services work". This is because monetizing a distribution is hard. Fortunately, we have made progress on making distributions more commercially viable.

At Acquia, our Drupal Gardens product taught us a lot about how to monetize a single Drupal distribution through a SaaS model. We discontinued Drupal Gardens but turned what we learned from operating Drupal Gardens into Acquia Cloud Site Factory. Instead of hosting a single Drupal distribution (i.e. Drupal Gardens), we can now host any number of Drupal distributions on Acquia Cloud Site Factory.

This is why Nasdaq's offering is so interesting; it offers a powerful example of how organizations can leverage the distribution "as-a-service" model. Nasdaq has built a custom Drupal 8 distribution and offers it as-a-service to their customers. When Nasdaq makes money from their Drupal distribution they can continue to invest in both their distribution and Drupal for many years to come.

In other words, distributions have evolved from an expensive lead generation tool to something you can offer as a service at a large scale. Since 2006 we have known that hosted service models are more compelling but unfortunately at the time the technology wasn't there. Today, we have the tools that make it easier to deploy and manage large constellations of websites. This also includes providing a 24x7 help desk, SLA-based support, hosting, upgrades, theming services and go-to-market strategies. All of these improvements are making distributions more commercially viable.

Categories: Drupal

Zhilevan Blog: Drupal Security Shield For Contributed Modules,What That Means?

Planet Drupal - 14 February 2017 - 10:32am
If you have been looking around for new Drupal contributed modules lately, or just reviewing the release versions and statuses for modules that you are using, you might have noticed a new shield icon at the bottom of the project information section.
Categories: Drupal

TimOnWeb.com: Add reCaptcha to your Drupal 7 forms programatically

Planet Drupal - 14 February 2017 - 9:14am

If you want to add Google's reCaptcha (https://www.google.com/recaptcha/intro/index.html) to your Drupal 7 forms programmatically you need to follow these two steps:

1) Install and enable captcha (https://www.drupal.org/project/captcha) and recaptcha (https://www.drupal.org/project/recaptcha) modules. The best ...

Read now

Categories: Drupal

Acquia Developer Center Blog: Drupal 8 Module of the Week: Brightcove Video Connect

Planet Drupal - 14 February 2017 - 8:51am

This week: Brightcove Video Connect Module // Drupal 8 has more and more features available practically every day. Alongside module migrations and new projects, the Drupal community’s latest major release also offers new ways of solving common problems. Some functionality has moved to Drupal core and new modules have taken up the torch along the way. In this series, the Acquia Developer Center is profiling useful solutions--modules, themes, distros, and more--available for Drupal 8.

Tags: acquia drupal planetbrightcovevideo
Categories: Drupal

Drupal.org blog: What's new on Drupal.org? - January 2017

Planet Drupal - 14 February 2017 - 8:42am

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.

Drupal.org updates Recognizing more types of contribution in the Drupal.org Marketplace

We were very pleased to announce an expansion of the issue credit system into a broader contribution credit system which recognizes more than just code contributions for the purposes of ranking organizations in the marketplace.

We now calculate the following 4 types of contribution into overall contribution credit:

User research for the upcoming industry pages

In a previous blog post on Drupal.org, we talked about our increasing focus on the adoption journey and our plans to create industry specific landing pages on Drupal.org. In January we did extensive user research with people in media and publishing, higher education, and government, which will be the first industries we promote. We're hoping to launch these pages very soon, so keep an eye on the home page.

Preparing for community elections for the Drupal Association board

The elections process for the community seats on the Drupal Association board kicks off with self-nominations in February each year. This means that we dedicated some time in January to making small refinements and improvements to the nomination process. In particular we've added more in-context educational materials about the board to the self-nomination form, including a video by executive director Megan Sanicki. We've also refined our candidate questions to help candidates express their unique qualifications.

If you're interested in bringing your perspective to the Drupal Association board, please nominate yourself.

Membership history messaging

To make it easier for members to understand their membership history, we've added new messaging to the membership join and renew pages. Users who go to join or renew their Drupal Association membership will now see a message indicating their current membership expiration date, their last contribution amount, a link to contribute again, and their auto-renewal status.

Migration of Drupal Association content to Drupal.org

In January we also migrated the majority of content from assoc.drupal.org to a new section on Drupal.org itself. This effort is part of our larger content restructure initiative. By moving Drupal Association content into Drupal.org we hope to increase discoverability of information about the DA, and create a tighter integration between Drupal Association news and the front-page news feed.

DrupalCI Checkstyle results now available on the DrupalCI dispatcher

Thanks to community member mile23, DrupalCI now supports automated code style testing. To see checkstyle results for any test on Drupal.org, click on the test result bubble and then click the 'view results' link to view the detailed test results on DrupalCI's jenkins dispatcher.

We're still gathering input and feedback for this initial release of the checkstyle feature, as we decide how to integrate the checkstyle results more tightly with Drupal.org. If you have feedback or suggestions please leave your comments in this issue: #1299710: [meta] Automate the coding-standards part of patch review.

Updated testing environments

DrupalCI supports testing code against a matrix of php and database versions. In January we updated the php environments that DrupalCI supports, so that you can test against the minimum supported versions or the latest point releases. Our 5.X containers have been upgraded to the latest version for each minor release (5.3.29, 5.4.45, 5.5.38, 5.6.29). The singular PHP 7 environment that we were using was following the 7.0.x branch of php7. This has now been expanded into four php 7 environments, 7.0 (7.0.14), 7.1 (7.1.0), 7.0.x, and 7.1.x.

The dev versions of php are primarily intended for Core to sense upstream changes to php before they become released, as our comprehensive test suite often finds unanticipated bugs in php7. Additionally some missing features in the php7 containers were added, specifically apcu.

Local testing improvements

DrupalCI has always supported local testing, in order to allow developers to test changes on their own machines. This is helpful for several reasons: it allows people to test on their own machines before triggering one of the DrupalCI test bots, it lets users troubleshoot failing tests, and it helps to eliminate the 'works on my machine' problem where code appears to work in a local environment, but fails on the test bots.

To make local testing even easier, DrupalCI now automatically generates a vagrant environment for local testing. To use this functionality simply clone the drupalci_testrunner.git repo and then run $ vagrant up from within the directory. Furthermore, DrupalCI can download a build.yml file from a dispatcher.drupalci.org url to replicate any test that has been run on Drupal.org. More information about this will be added to the DrupalCI documentation soon.

Adding test priority

DrupalCI runs thousands of tests of the Drupal codebase for core and contrib modules every month. These tests include commit and patch testing for the active development which may be occurring at any time day or night, as well as the hundreds of daily regression tests run for both core and contrib projects. To help make testing more responsive, we've added a notion of testing priority. When there is a queue of waiting tests, Drupal 8 core patch tests will take priority; followed by D8 branch tests; followed by D8 contrib tests; followed by Drupal 7 patch, branch, and contrib tests.

Community Initiatives Project Applications Revamp

Our primary community initiative priority for the first quarter of the new year is the Project Application Revamp. There are four phases to the revamp: 1) preserving security advisory coverage signals about projects, 2) transitioning security advisory coverage to an opt-in process, 3) opening the gates to allow any user to promote a project to full and create releases, 4) building new tools to incentivize code review and provide code quality signals on project pages. One of the changes we made as part of phase 1 was to adjust the way recommended releases are highlighted on Drupal.org project pages.

Contrib Documentation Migration

Project maintainers are now able to create documentation guides on their projects using the new documentation content types. Maintainers can then migrate their old documentation content into these new guides, or create new documentation pages. For more information about this process, please consult our guide to contrib documentation.

Help port Dreditor features to Drupal.org

Are you a Drupal.org power user who relies on Dreditor? Markcarver is currently leading the charge to port Dreditor features to Drupal.org, and invites anyone interested in contributing to join him in #dreditor on freenode IRC or the Dreditor GitHub.

———

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

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

Categories: Drupal

Evolving Web: Installing Drupal Console on Windows

Planet Drupal - 14 February 2017 - 6:56am

The Drupal Console has become a great command-line tool for managing Drupal 8 sites. In our Drupal 8 Module Development Trainings, we use it to automatically generate boilerplate code, so our trainees can get a quick start! Even though Drupal Console has been out for just one year, it already has over four hundred thousand downloads.

read more
Categories: Drupal

Search API Synonym

New Drupal Modules - 14 February 2017 - 3:37am
INTRODUCTION

This module let editors or administrators manage synonyms for Search API
directly in Drupal.

Synonyms can be export using the build in Drupal Console command.
Drush command and automatic export using Drupal cron job is in development.

The module support the synonyms.txt format used in Apache Solr.
Other formats can be added using the Export plugin annotation.

Categories: Drupal

Wim Leers: A career thanks to open source

Planet Drupal - 14 February 2017 - 2:48am

Hasselt University Professor Frank Neven asked me to come and talk a bit about my experience in open source, and how it helped me. It helped me during my studies, in my career and even in life :)

Slides: http://wimleers.com/talk-oss-career/Location: Hasselt UniversityDate: Feb 14 2017 - 15:30
Categories: Drupal

Agiledrop.com Blog: AGILEDROP: Other Top Drupal Blogs from January

Planet Drupal - 14 February 2017 - 1:05am
Maybe a little late, but nevertheless, it's time to present you the best Drupal blogs that were written in the previous month. So, here's the work by other authors from January. We begin our overview with Danny Sipos, who wrote Advanced techniques for route access control in Drupal 8. In his article, he looked at an example of a complex access requirement. He used a trick that opened the door to some complex access restriction rules on your routes. You can read the full blog post here. Our second choice was How to Build Drupal Slideshow Using Views and Slick by Daniel Pickering. The… READ MORE
Categories: Drupal

MidCamp - Midwest Drupal Camp: We want you to speak at MidCamp 2017!

Planet Drupal - 13 February 2017 - 8:44pm
Session Submissions close Saturday, February 18th

MidCamp is looking for folks just like you to speak to our Drupal audience! Experienced speakers are always welcome, but MidCamp is also a great place to start for first-time speakers. We currently have 69 submitted sessions and are looking for more.  Please see our session tracks page to see what kind of talks we are looking for. Subject matter can be Drupal, PHP in general, related technologies, soft skills, testing, tools, workflow, etc.

Sessions submission will close Saturday, February 18th, 2017, so don't delay!

Find out more at: Buy a Ticket

Tickets and Individual Sponsorships are available on the site for MidCamp 2017. Click here to get yours!

Schedule of Events
  • Thursday, March 30th, 2017 - Training and Sprints
  • Friday, March 31st, 2017 - Sessions and Social
  • Saturday, April 1st, 2017 - Sessions and Social
  • Sunday, April 2nd, 2017 - Sprints
Sponsor MidCamp 2017!

Are you or your company interested in becoming a sponsor for the 2017 event? Sponsoring MidCamp is a great way to promote your company, organization, or product and to show your support for Drupal and the Midwest Drupal community. It also is a great opportunity to connect with potential customers and recruit talent.

Find out more at: Stay connected:

"The time is coming," the walrus said, "to talk of many things…"

Categories: Drupal

How Nasdaq offers a Drupal distribution as-a-service

Dries Buytaert - 13 February 2017 - 12:29pm

Nasdaq CIO and vice president Brad Peterson at the Acquia Engage conference showing the Drupal logo on Nasdaq's MarketSite billboard in Times Square NYC.

Last October, I shared the news that Nasdaq Corporate Solutions has selected Acquia and Drupal 8 for its next generation Investor Relations and Newsroom Website Platforms. 3,000 of the largest companies in the world, such as Apple, Amazon, Costco, ExxonMobil and Tesla are currently eligible to use Drupal 8 for their investor relations websites.

How does Nasdaq's investor relations website platform work?

First, Nasdaq developed a "Drupal 8 distribution" that is optimized for creating investor relations sites. They started with Drupal 8 and extended it with both contributed and custom modules, documentation, and a default Drupal configuration. The result is a version of Drupal that provides Nasdaq's clients with an investor relations website out-of-the-box.

Next, Nasdaq decided to offer this distribution "as-a-service" to all of their publicly listed clients through Acquia Cloud Site Factory. By offering it "as-a-service", Nasdaq's customers don't have to worry about installing, hosting, upgrading or maintaining their investor relations site. Nasdaq's new IR website platform also ensures top performance, scalability and meets the needs of strict security and compliance standards. Having all of these features available out-of-the-box enables Nasdaq's clients to focus on providing their stakeholders with critical news and information.

Offering Drupal as a web service is not a new idea. In fact, I have been talking about hosted service models for distributions since 2007. It's a powerful model, and Nasdaq's Drupal 8 distribution as-a-service is creating a win-win-win-win. It's good for Nasdaq's clients, good for Nasdaq, good for Drupal, and in this case, good for Acquia.

It's good for Nasdaq's customers because it provides them with a platform that incorporates the best of both worlds; it gives them the maintainability, reliability, security and scalability that comes with a cloud offering, while still providing the innovation and freedom that comes from using Open Source.

It is great for Nasdaq because it establishes a business model that leverages Open Source. It's good for Drupal because it encourages Nasdaq to invest back into Drupal and their Drupal distribution. And it's obviously good for Acquia as well, because we get to sell our Acquia Site Factory Platform.

If you don't believe me, take Nasdaq's word for it. In the video below, which features Stacie Swanstrom, executive vice president and head of Nasdaq Corporate Solutions, you can see how Nasdaq pitches the value of this offering to their customers. Swanstrom explains that with Drupal 8, Nasdaq's IR Website Platform brings "clients the advantages of open source technology, including the ability to accelerate product enhancements compared to proprietary platforms".

Categories: Drupal

Dries Buytaert: How Nasdaq offers a Drupal distribution as-a-service

Planet Drupal - 13 February 2017 - 12:29pm

Nasdaq CIO and vice president Brad Peterson at the Acquia Engage conference showing the Drupal logo on Nasdaq's MarketSite billboard in Times Square NYC.

Last October, I shared the news that Nasdaq Corporate Solutions has selected Acquia and Drupal 8 for its next generation Investor Relations and Newsroom Website Platforms. 3,000 of the largest companies in the world, such as Apple, Amazon, Costco, ExxonMobil and Tesla are currently eligible to use Drupal 8 for their investor relations websites.

How does Nasdaq's investor relations website platform work?

First, Nasdaq developed a "Drupal 8 distribution" that is optimized for creating investor relations sites. They started with Drupal 8 and extended it with both contributed and custom modules, documentation, and a default Drupal configuration. The result is a version of Drupal that provides Nasdaq's clients with an investor relations website out-of-the-box.

Next, Nasdaq decided to offer this distribution "as-a-service" to all of their publicly listed clients through Acquia Cloud Site Factory. By offering it "as-a-service", Nasdaq's customers don't have to worry about installing, hosting, upgrading or maintaining their investor relations site. Nasdaq's new IR website platform also ensures top performance, scalability and meets the needs of strict security and compliance standards. Having all of these features available out-of-the-box enables Nasdaq's clients to focus on providing their stakeholders with critical news and information.

Offering Drupal as a web service is not a new idea. In fact, I have been talking about hosted service models for distributions since 2007. It's a powerful model, and Nasdaq's Drupal 8 distribution as-a-service is creating a win-win-win-win. It's good for Nasdaq's clients, good for Nasdaq, good for Drupal, and in this case, good for Acquia.

It's good for Nasdaq's customers because it provides them with a platform that incorporates the best of both worlds; it gives them the maintainability, reliability, security and scalability that comes with a cloud offering, while still providing the innovation and freedom that comes from using Open Source.

It is great for Nasdaq because it establishes a business model that leverages Open Source. It's good for Drupal because it encourages Nasdaq to invest back into Drupal and their Drupal distribution. And it's obviously good for Acquia as well, because we get to sell our Acquia Site Factory Platform.

If you don't believe me, take Nasdaq's word for it. In the video below, which features Stacie Swanstrom, executive vice president and head of Nasdaq Corporate Solutions, you can see how Nasdaq pitches the value of this offering to their customers. Swanstrom explains that with Drupal 8, Nasdaq's IR Website Platform brings "clients the advantages of open source technology, including the ability to accelerate product enhancements compared to proprietary platforms".

Categories: Drupal

CU Boulder - Webcentral: Upgrading A Drupal 7 Module to Drupal 8 - Adding Routing and Menu Links

Planet Drupal - 13 February 2017 - 11:10am

When planning to upgrade a module from Drupal 7 to Drupal 8, I was originally going to start out doing TDD and unit testing before I wrote any code for this module, but since I know very little about OOP practices and Drupal 8 changes, I figured it would be easier to start out with the simplest test I could think of: visiting a path and getting a 200 response code. 

In my module, an action link is added to "admin/people" in order for users to navigate to the form where they invite new users to the site. To test if the path exists and returns a 200 HTTP response, I have to create that part of the module first.

Learn By Example

I've mentioned before that my module depends on the Token module and that I would be using examples in that codebase when I need guidance...which is all the time currently :) So, I looked in that module's routing file to copy an example route. 

If you don't know anything about how Symfony's routing system works, then you should read up on Drupal's documentation for routing. To start, you need to create a ".routing.yml" file. My user_external_invite.routing.yml file started out like this:

user_external_invite.invite_users: path: '/admin/people/invite/invite' defaults: _controller: '\Drupal\user_external_invite\Controller\UserInviteController::inviteUsers' _title: 'Invite Users' requirements: _permission: 'invite users' user_external_invite.manage_invites: path: '/admin/people/invite/operations' defaults: _controller: '\Drupal\user_external_invite\Controller\UserInviteController::manageInvites' _title: 'Manage Invites' requirements: _permission: 'invite users' user_external_invite.settings.form: path: '/admin/config/people/invite' defaults: _form: '\Drupal\user_external_invite\Form\InviteSettingsForm' _title: 'User External Invite Settings' requirements: _permission: 'administer users'

As you can see, at the top level you start out with the route name which will be your module's machine name and the purpose of the route. I only have three routes for my module: the page where you can invite users, the page where you can manage invites that have been sent out, and the configuration page for admins. 

Adding A Controller

The part of the routing file that is most different, at least for me, is the "_controller" parameter. In Drupal 7, the "page callback" part of hook_menu() essentially acted as the controller; however, the function specified generally ended up in the same .module file making it simple to connect the two parts together.

By placing the controller file in a certain directory structure, Drupal will automatically load that class and call the method you specify. The exact structure of your file placement is kind of arbitrary, but it is common to separate different functionality into different folders. So, I have "src/Controller/" for controller classes and "src/Form" for forms. Entities, Plugins, and Event Subscribers are other examples of other types of things that might warrant their own directories; however, you can place all your files directly in the "src" directory if you were lazy and wanted to do so. Don't be lazy, though; I won't pick you to join my Drupal dodgeball team if you are.

class UserInviteController extends ControllerBase { public function inviteUsers() { return array( '#markup' => 'Page Content...', ); } }

Although my controller has a lot more going on in it, in order to get a working page up and running that we can browse to I had to write an "inviteUsers" function and return something in it. After adding that code and clearing the cache, I can navigate to "admin/people/invite/invite" and see the fruits of my labor. 

 

Action Links

While adding a link to that page of the module is all fine and good, I still have no way of having users know that can get to that page since it existed as an action link in Drupal 7 on the user overview page. 

If you remember the good ole days of hook_menu(), you could define an item as a "MENU_LOCAL_TASK" with a "MENU_DEFAULT_LOCAL_TASK" item to render a page with two or more tabs on it. In Drupal 8, those tabs have been split up into files for tasks and actions. The definitions for tasks and actions are very similar; the distinction is in where you want them placed on the page. 

user_external_invite.invite_users: route_name: user_external_invite.invite_users title: 'Invite user' appears_on: - entity.user.collection

For users to see the invite page from "admin/people" as it had been placed in Drupal 7, I had to create a "user_external_invite.links.action.yml" file. In it, I provided the route that matches the "Invite user" page and told Drupal what page the action link appears on. I ended up searching the User module's files in order to get the parent route to place in the "appears_on" key.

 

Local Tasks

To add tabs for the invite management pages, I had to create another file specifically for the local tasks, "user_external_invite.links.task.yml", a.k.a tabs. 

user_external_invite.invite: route_name: user_external_invite.invite_users base_route: user_external_invite.invite_users title: 'Invite Users' weight: 1 user_external_invite.manage: route_name: user_external_invite.manage_invites base_route: user_external_invite.invite_users title: 'Manage Invites' weight: 2

Instead of having duplicate entries to define the base path and the default tab, a "base_route" key is added to define link hierarchy. This key is essentially the same as the "appears_on" key for action items. For the default tab, the "base_route" and "route_name" are the same, and for any subsequent tabs, the base route will be the default tab's route name. Once you add that code and rebuild the cache, you should see tabs show up on your module's page. 

 

Forms

The last path I need users to get to for my module is a configuration form. In Drupal 7, you could use drupal_get_form() as a special callback to load a form at a path, and in Drupal 8, the "_form" key takes over that functionality. In "InviteSettingsForm.php", I have a class that extends "ConfigFormBase" giving me some useful functionality related to getting configuration objects to manipulate. 

class InviteSettingsForm extends ConfigFormBase { /** * InviteSettingsForm constructor. * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory */ public function __construct(ConfigFactoryInterface $config_factory) { parent::__construct($config_factory); } /** * @param \Symfony\Component\DependencyInjection\ContainerInterface $container * @return static */ public static function create(ContainerInterface $container) { return new static( $container->get('config.factory') ); } /** * {@inheritdoc} */ public function getFormId() { return 'user_external_invite_settings_form'; } /** * {@inheritdoc} */ protected function getEditableConfigNames() { return ['user_external_invite.settings']; } public function buildForm(array $form, FormStateInterface $form_state) { $config = $this->config('user_external_invite.settings'); // Days invite valid for. $form['user_external_invite_days_valid_for'] = array( '#type' => 'textfield', '#title' => t('Number of days invites are valid'), '#description' => t("Invites are set to expire so many days after they are created. If a user hasn't accepted the invite by that time, then you will have to send a new invite to grant that user a role."), '#default_value' => $config->get('user_external_invite_days_valid_for'), '#element_validate' => array('element_validate_number'), '#maxlength' => 3, ); // More form items... // Submit button. $form['actions'] = ['#type' => 'actions']; $form['actions']['submit'] = [ '#type' => 'submit', '#value' => $this->t('Save configuration'), ]; return parent::buildForm($form, $form_state); }

The "getFormId()" and "getEditableConfigNames()" methods are required when extending "ConfigFormBase". The form ID can be arbitrary, but I made it resemble the machine name in the routing.yml file. The editable config name should correspond to the file you would have in "config/install" for default configuration settings.

 

After adding that code and clearing the cache, my form shows up at the right path. However, a user would have to know the exact path of the form in order to see it until I declare a menu link pointing to the form's route.

user_external_invite.settings: title: 'User External Invite Settings' description: 'Configure roles to invite and invite message settings.' route_name: user_external_invite.settings.form parent: user.admin_index

The tricky part of adding "user_external_invite.links.menu.yml" is finding the parent route to link it to. For some reason, the "admin/config/people" route is different than all of the other routes on "admin/config" so to find out which parent route I needed to add, I used Drupal Console and the "drupal router:debug" command. When I grepped that command for config routes, every other top level section on "admin/config" had a route that started off with "system.admin_config_" while the people config section was "user.admin_index". Go figure. 

After adding that menu links file and clearing the cache, I can see the link to the config form in the people section.

 

With those three links files and the routing file, you should be good to go setting up routing in your Drupal 8 module. Now comes the hard part of writing the code to fill out those pages you've just made links for.  

Developer Blog
Categories: Drupal

Jeff Geerling's Blog: Tips for Managing Drupal 8 projects with Composer

Planet Drupal - 13 February 2017 - 10:12am

It's been over a year since Drupal 8.0.0 was released, and the entire ecosystem has improved vastly between that version's release and the start of the 8.3.0-alpha releases (which just happened a couple weeks ago).

One area that's seen a vast improvement in documentation and best practices—yet still has a ways to go—is Composer-based project management.

Along with a thousand other 'get off the island' initiatives, the Drupal community has started to take dependency management more seriously, by integrating with the wider PHP ecosystem and maintaining a separate Drupal.org packagist for Drupal modules, themes, and other projects.

Categories: Drupal

Web Wash: Webinar: How to Build Custom Search Pages in Drupal 8

Planet Drupal - 13 February 2017 - 9:13am
The definition of "what a search page is" varies from project to project. Some clients are happy with the core Search module, others want a full blown search engine. Drupal offers a wide range of options when it comes to building custom search pages. You can create a basic search page using the core Search module or if you're looking for something advanced you could use Search API.
Categories: Drupal

Views Extras (Session/Cookie/Token Support)

New Drupal Modules - 13 February 2017 - 8:35am

Views extra modules provide extra arguments for contextual filters based on session, cookie or token. This extends filter functionality to pass cookie, session variable or token as argument to views.

MODULE DETAILS
--------------
Views Extras allows to create views that accept arguments from session, cache or token. As of now, module provides following type of arguments:

Categories: Drupal

Evolving Web: Drupal 8 Configuration Management for Multi-site

Planet Drupal - 13 February 2017 - 7:17am

Often, you develop a website to be installed and used once, by one organization. But sometimes, for larger organizations, you need to develop a series of websites that are very similar. This case is very common in big institutions with independent departments or branches, such as:

read more
Categories: Drupal

RESTful Web Services: Resource Discovery

New Drupal Modules - 13 February 2017 - 5:37am

Allows a list of entities (including bundle, field and property info) to be viewed at /restws_resource.json.

Motivation: a 3rd party system may not be aware of all entity types available, so a list of entity info is useful. There are some obvious entity types, such as node, comment etc but any custom entity types will not be known to a 3rd party.

Categories: Drupal

Devel Mode

New Drupal Modules - 13 February 2017 - 5:30am

Development:

https://github.com/b-connect/devel_mode

Helper module for developers.

- Twig configuration
- Cache bin configuration
- Page cache
- Module enabling / disabling

Configuration in services.yml

config.devel_mode: disable_preprocess_js: TRUE disable_preprocess_css: TRUE modules: - devel - webprofiler cache.bin: - render twig: debug: TRUE auto_reload: TRUE cache: FALSE
Categories: Drupal

lakshminp.com: DIY Drupal hosting: OpenDevShop

Planet Drupal - 13 February 2017 - 3:49am

Checkout introduction and part 1 if you haven't already.

Richa(all proper nouns changed to protect privacy), our QA, is doing the final testing of a client feature which will go live in a while. Its 4 PM and Friday Happy hour will start soon. Richa is testing a Drupal 7 site packed with tons of contrib and custom modules, and in case you are wondering, yes, we do deploy on Friday evenings at Acme Inc. Its like any other day here.

Categories: Drupal

Pages

Subscribe to As If Productions aggregator - Drupal