Drupal

OSTraining: What Does Delta Mean in Drupal?

Planet Drupal - 2 November 2017 - 9:44pm

When you are adding Views, you may have seen an extra option called "Delta".

Several students have asked us about the purpose of this field, because it wasn't clear.

The Delta option is available throughout the site, but ordinary users are most likely to encounter it inside Views. Here's how the "Delta" options appear in Views:

Categories: Drupal

Extlink Multi Page Alert

New Drupal Modules - 2 November 2017 - 9:01pm

This is a very simple simple sub-module of Extlink . Extlink doesn't provide page wise different alert message. This module will extend the Extlink module's capability to accommodate multiple alert message settings per page basis.

Categories: Drupal

PreviousNext: Safely extending Drupal 8 plugin classes without fear of constructor changes

Planet Drupal - 2 November 2017 - 3:34pm
Share:

From time to time you may find you need to extend another module's plugins to add new functionality.

You may also find you need to alter the signature of the constructor in order to inject additional dependencies.

However plugin constructors are considered internal in Drupal's BC policy.

So how do you safely do this without introducing the risk of breakage if things change.

In this article we'll show you a quick trick learned from Search API module to avoid this issue.

by Lee Rowlands / 3 November 2017

So let's consider a plugin constructor that has some arguments.

Here's the constructor and factory method for Migrate's SQL map plugin

/**
   * Constructs an SQL object.
   *
   * Sets up the tables and builds the maps,
   *
   * @param array $configuration
   *   The configuration.
   * @param string $plugin_id
   *   The plugin ID for the migration process to do.
   * @param mixed $plugin_definition
   *   The configuration for the plugin.
   * @param \Drupal\migrate\Plugin\MigrationInterface $migration
   *   The migration to do.
   */
  public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration, EventDispatcherInterface $event_dispatcher) {
    parent::__construct($configuration, $plugin_id, $plugin_definition);
    $this->migration = $migration;
    $this->eventDispatcher = $event_dispatcher;
  }

  /**
   * {@inheritdoc}
   */
  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration = NULL) {
    return new static(
      $configuration,
      $plugin_id,
      $plugin_definition,
      $migration,
      $container->get('event_dispatcher')
    );
  }

As you can see, there are two additional dependencies injected beyond the standard plugin constructor arguments - the event dispatcher and the migration.

Now if you subclass this and extend the constructor and factory to inject additional arguments, should the base plugin change its constructor, you're going to be in trouble.

Instead, you can use this approach that Search API takes - leave the constructor as is (don't override it) and use setter injection for the new dependencies.

/**    * {@inheritdoc}    */   public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration = NULL) {     $instance = parent::create(       $container,       $configuration, $plugin_id,       $plugin_definition,       $migration     ); $instance->setFooMeddler($container->get('foo.meddler'); return $instance;   } /** * Sets foo meddler. */ public function setFooMeddler(FooMeddlerInterface $fooMeddler) { $this->fooMeddler = $fooMeddler; }

Because the signature of the parent create method is enforced by the public API of \Drupal\Core\Plugin\ContainerFactoryPluginInterface you're guaranteed that it won't change.

Thanks to Thomas Seidl for this pattern

Tagged Drupal 8, Plugins, OOP

Posted by Lee Rowlands
Senior Drupal Developer

Dated 3 November 2017

Comments

Comment by dawehner

Dated 3 November 2017

Nice!! Thank you for sharing it!

Pagination Add new comment
Categories: Drupal

Webform Wizard Full Title

New Drupal Modules - 2 November 2017 - 8:37am

Module to extend functionality of Webform so on wizard forms, the title of the wizard page can override the form title.

Categories: Drupal

Meta position

New Drupal Modules - 2 November 2017 - 6:58am

This module is useful only if you use the seven theme administration or any administration theme which extends seven (as adminimal theme for example).

This small module allows you to place the metadata panel (containing menu settings, URL path settings, authoring informations, promotions options, etc.) under the node main form and displayed as vertical tabs.

You can configure the module and choose on which content type you want display this metadata panel as vertical tabs under the main node form.

Categories: Drupal

Commerce Tripletex

New Drupal Modules - 2 November 2017 - 6:12am

Tripletex is one of online accounting platform. This module allows you to integrate your Drupal Commerce website with Tripletex ERP/CRM platform.

Categories: Drupal

Drop Guard: Automatic updates - a study by the University of North Carolina State

Planet Drupal - 2 November 2017 - 4:45am
Automatic updates - a study by the University of North Carolina State

A study from the North Carolina State University discovered that projects which are using open source libraries are updated 60% more often when using automatic updates via pull requests. The base of the study are 7,470 repositories on GitHub. This blog post is a summary of the most important facts and highlights of the methods, challenges and tools when it comes to use of automation for reaching a higher security level while using open source libraries.

There are 3 main facts why open source updates are a pain for developers
  1. Developers are always busy and doing updates is no fun

Drupal Planet Business Events Security PHP Study
Categories: Drupal

Mautic Integration

New Drupal Modules - 2 November 2017 - 4:04am

Adds the Mautic web statistics tracking system to your website.

Categories: Drupal

GoPay

New Drupal Modules - 2 November 2017 - 2:48am

Drupal wrapper for GoPay PHP SDK.

Currently allows:

  • set GoPay payment settings
  • programatically create payment and render payment button
  • you have to manually handle payment creation a processing GoPay response
Instalation

composer require drupal/gopay

This installation automatically download GoPay PHP SDK.

If you install module manually you have to take care of GoPay PHP SDK.

Categories: Drupal

Web Omelette: My First Book - Drupal 8 Module Development (Or Where I Have Been Lately)

Planet Drupal - 2 November 2017 - 12:01am

If you’ve been wondering where I’ve been and why I haven’t been writing any articles lately, I am here to put your mind at ease: i’ve been working heavily on my first book about Drupal, called Drupal 8 Module Development. And I am happy to announce that it has finally been published and available for purchase.

Released by Packt Publishing, a leading publishing house for technical books in the Open Source world, my book is a comprehensive guide for developers new to Drupal 8. It aims to introduce you to module development starting from scratch but building up to complex functionalities. In doing so, you learn about all the fundamental subsystems and APIs available to work with in your Drupal module.

As you know, my website mainly focuses on Drupal knowledge via articles about tips and techniques, especially in Drupal 8 (most recently). So if you’ve been finding these helpful, I recommend checking out my book as it contains about 500 pages of great content aiming to help you ramp up your Drupal 8 module development skills. I appreciate each and every one who decides to give it a chance and I hope you find it as useful as I intended it to be.

Here is the list of chapters that will take you on the journey from starting a simple module to writing performant functionality using complex subsystems and APIs:

  • Chapter 1,  Developing for Drupal 8 , provides an introduction to module development in Drupal 8. In doing so, it introduces the reader to the various subsystems and outlines the requirements for running a Drupal 8 application.
  • Chapter 2,  Creating Your First Module , gets the ball rolling by creating the first Drupal 8 module of the book. Its main focus is to explore the most common things module developers need to know from the get-go.
  • Chapter 3,  Logging and Mailing , is about the tools available for doing something every web- based application does and/or should be doing, that is, sending emails and logging events.
  • Chapter 4,  Theming , presents the theme system from a module developer's perspective in Drupal 8.
  • Chapter 5,  Menus and Menu Links , explores the world of menus in Drupal 8 and shows how to programmatically create and work with menu links.
  • Chapter 6,  ata Modeling and Storage , looks at the various types of storage available in Drupal 8, from the state system to configuration and entities.
  • Chapter 7,  Your Own Custom Entity and Plugin Types , takes a hands-on approach creating a custom configuration and content entity type, as well as custom plugin type to wire up a practical functional example.
  • Chapter 8,  The Database API , presents the database abstraction layer and how we can work directly with data stored in custom tables.
  • Chapter 9,  Custom Fields , exemplifies the creation of the three plugins necessary for creating a custom field that can be used on a Drupal 8 content entity type.
  • Chapter 10,  Access Control , explores the world of access restrictions in Drupal 8, from roles and permissions to route and entity access checks.
  • Chapter 11,  Caching , looks at the various cache mechanisms available for module developers to improve the performance of their functionality.
  • Chapter 12,  Javascript and the AJAX API , introduces module developers to the specificities of writing JavaScript in Drupal 8, as well as the powerful AJAX system, which can be used to build advanced interactions.
  • Chapter 13,  Internationalization and Languages , deals with the practices Drupal 8 module developers need to observe in order to ensure that the application can be properly translated.
  • Chapter 14,  Batches, Queues, and Cron , explores the various ways module developers can structure their data processing tasks in a reliable way.
  • Chapter 15,  Views , looks at the various ways module developers can programmatically interact with Views and even expose their own data to them.
  • Chapter 16,  Working with Files and Images , explores the various file and image APIs that allow module developers to store, track, and manage files in Drupal 8.
  • Chapter 17,  Automated Testing , explores the various types of automated test module developers can write for their Drupal 8 applications to ensure stable and resilient code.
  • Annex, Drupal 8 Security , recaps some of the main things module developers need to pay attention to for writing secure code in Drupal 8.

If you find something incorrect or out of place, please use the appropriate errata submission form mentioned in the book. And as always, feel free to drop comments below about the your thoughts on the book. Enjoy and thank you very much for purchasing my book!

Categories: Drupal

Block Backup/Restore

New Drupal Modules - 1 November 2017 - 9:56pm
Categories: Drupal

Hook 42: October Accessibility (A11Y) Talks

Planet Drupal - 1 November 2017 - 6:18pm

This month we had Nicolas Steenhout joining us to talk about "Accessibility: Don't turn off that JavaScript just yet."

The year is 2017, and JavaScript has never been as ubiquitous. Long gone are the days when in order to be considered accessible, pages had to work flawlessly without scripting. Scripting has also come a long way, and developers are now even leveraging the powers of JavaScript to rewrite content in order to make it more accessible to assistive technologies.

Categories: Drupal

Nextide Blog: Maestro D8 Concepts Part 4: Interactive Task Edit Options

Planet Drupal - 1 November 2017 - 6:04pm

This is part 4 of the Maestro for Drupal 8 blog series, defining and documenting the various aspects of the Maestro workflow engine.  Please see Part 1 for information on Maestro's Templates and Tasks, Part 2 for the Maestro's workflow engine internals and Part 3 for information on how Maestro handles logical loopback scenarios.

Categories: Drupal

Quick add field data

New Drupal Modules - 1 November 2017 - 5:33pm

This module helps you create all your field quickly from excel by exemple,
1/ select your entity, support User, node, taxonomy, field collection, paragraphs
2/ copy and paste your header (row or column)
3/ select module you want generate automatic (support search api, Views, feeds)
4/ select your type and widget
5/ submit

Categories: Drupal

Freelock : Freelock Interviewed on Drupal and WordPress Expertise

Planet Drupal - 1 November 2017 - 4:42pm
microphone-with-screen-with-chart.jpg

In September, Freelock was recognized as a leading web development company in Seattle by Clutch. Not only were we thrilled to be featured in that report and ranked as one of the top three web developers in the area, but we are excited to share that as a result, Clutch interviewed us on our web development expertise.

Drupal PlanetSecurityDrupalWordPressDrupal 8CMS
Categories: Drupal

Image Field Repair

New Drupal Modules - 1 November 2017 - 1:44pm

Image Field Repair is a module that repairs image fields that are touched by issue #2644468: Multiple image upload breaks image dimensions.

Categories: Drupal

myDropWizard.com: Drupal 6 security update for Autologout 6.x-4.x

Planet Drupal - 1 November 2017 - 1:16pm

As you may know, Drupal 6 has reached End-of-Life (EOL) which means the Drupal Security Team is no longer doing Security Advisories or working on security patches for Drupal 6 core or contrib modules - but the Drupal 6 LTS vendors are and we're one of them!

Today, there is a Moderately Critical security release for the Autologout module to fix a Cross Site Scripting (XSS) vulnerability.

This module provides a site administrator the ability to log users out after a specified time of inactivity.

The module does not sufficiently filter user-supplied text that is shown when logging a user out. This vulnerability is mitigated by the fact that an attacker must have a role with the permission "administer autologout".

See the security advisory for Drupal 7 for more information.

Here you can download the Drupal 6 patch.

NOTE: This only affects the Autologout 6.x-4.x branch -- the 6.x-2.x branch (which we also support) isn't vulnerable.

If you have a Drupal 6 site using the Autologout module, we recommend you update immediately.

If you'd like all your Drupal 6 modules to receive security updates and have the fixes deployed the same day they're released, please check out our D6LTS plans.

Note: if you use the myDropWizard module (totally free!), you'll be alerted to these and any future security updates, and will be able to use drush to install them (even though they won't necessarily have a release on Drupal.org).

Categories: Drupal

Commerce sales popup

New Drupal Modules - 1 November 2017 - 12:00pm

- A pop up with a sale countdown timer.
- Access to a section of the site where you can edit countdown timer.
- Preview the sale popup so that I can verify it all looks clean.
- Display the sale popup either in modal window, or at the top of the page

Categories: Drupal

Pretty XSD errors

New Drupal Modules - 1 November 2017 - 11:16am

Adds an event subscriber to handle XSD validation exceptions from turnerlabs/validating-xml-encoder by outputting the error message in a comment at the top of the XML output.

PXE, sounds like pixie. Pixie dust. Sprinkle a pretty XSD error comment on your invalid dirty XML.

Categories: Drupal

Commerce Guys: Commerce Braintree integration adds PayPal Express Checkout and PayPal Credit support

Planet Drupal - 1 November 2017 - 11:13am

Drupal Commerce is more than just a module project. As I laid out in my session at DrupalCon Vienna, it is an entire ecosystem supported by dozens of agencies and powering well over $1.5bn in online transactions annually. This makes Drupal Commerce one of the largest open source eCommerce projects in the world, and it's thanks in no small part to our Technology Partners (comprised primarily of payment providers) that we are able to invest as much of our time in it as we do.

Braintree is one such partner and a fantastic supporter of Commerce 2.x since last Summer. During our sprint to release a beta at DrupalCon Dublin, they sponsored Bojan's time for two weeks to expand and improve the core Payment API.

As a result, they also became the first integrated payment gateway and the test case for any payment provider following their integration pattern - individual iframes embedded into the checkout form for each payment field, making it easy to securely collect payment card data through your own checkout form.

For the initial release of the Commerce Braintree integration on Drupal 8, we targeted basic credit card payment support via their Hosted Fields API. As of this week, we've finalized patches that add support for PayPal Express Checkout and PayPal Credit alongside credit card payment through Braintree. They are a PayPal company, after all!


Customers can pay via credit card on-site or Express Checkout via a modal dialog.

You can test the new features end to end by grabbing the latest release of the Commerce Braintree module and configuring it to work through the Braintree sandbox. If you get stuck, you can find us in the #commerce channel in the Drupal Slack or open an issue in the queue if that's not possible.

Thanks again to Braintree for their support and development sponsorship. If you'd like to learn more about how Technology Partners benefit our ecosystem, consider joining me and Commerce Braintree's D7 co-maintainer Andy Giles this weekend at DrupalCamp Atlanta (Nov. 3-4). I'll present a longer version of my DrupalCon session, Marketing and Selling the Drupal Commerce Ecosystem, and naturally I'll tap Andy to help me answer all your hardest questions. ; )

Categories: Drupal

Pages

Subscribe to As If Productions aggregator - Drupal