All RPGs and Storygames by Tod Foley are now available at DrivethruRPG and RPGnow. Bring these games to your table!
In the previous article Setting up Nginx on a Debian server as front-end for Apache of the series of articles for Drupal sysadmins we explained Nginx configs that allow it working through static queries while Apache serves dynamic content. This article offers a look at an alternative setup, where Php-fpm takes the place of Apache. The operating principle for our web server will be as follows:Tags
Game industry vets Anthony Palma and Cade Peterson chat with Gamasutra about Jump, their new indie game subscription service that aims to give passed-over games their time in the sun. ...
Dropbox upload allows you to add a new field type called dropbox_upload. Files added with this field are directly uploaded to an attached Dropbox account and stay there. The folder structure can be defined per field and can be token based.
When visiting content with dropbox files then the files are showed correctly.
Content migration is one of the most important factors that any experienced Drupal developers must take into account.
When working on a production state of your projects, upon finishing certain functions, you will need to move the progress to the production site by using the feature and coding export functions.
However, it is not easy as it seems.
If the number of nodes is small, developers can do it manually. But when it amounts to hundreds, thousands, or millions, that is quite risky.
Drupal's Entity reference fields are the magic sauce that allows site builders and developers to relate different types of content. Because the fields allows builders and administrators to reference different types of content (entities), it facilitates the building of complex data models and site architectures.
Like anything in Drupal, the community takes the core tools and builds additional functionality on top. Here is a slew of modules that extend or complement the Drupal 8 core reference field so you can do even more!Entity Reference Revisions
This module is from the team that brought you the Paragraphs module. Adds an Entity Reference field type that has revision support. It's based on the core Entity Reference module but allows you to reference a specific revision of an entity.
An entity is actually part of a parent entity (with an embedded entity form). When the parent entity is updated, the referenced entity is also updated, thus the previous revision of the parent entity should still be pointing to the previous version of the entity in order to fully support revision diff and rollback.Entity Reference Override
An entity reference field paired with a text field. You can use this module to
- Override the title if you are linking to the referenced entity.
- Add an extra CSS class to the referenced entity.
- Override the default display mode for the field on an entity-by-entity basis.
Aggregate lists of referenced entities like related articles, but you want to override the name or appearance of individual items.Entity references with text
Allows you to provide custom text along with one or more entity references.
- Add a referenced author, the word "and ”, and then another referenced author.
- On another node, Add a referenced author, the words "with support from ”, and then another referenced author.
- On another node, Add a referenced author, a comma ", ”, another referenced author, the word "and ”, and then another referenced author.
This module adds a field type that allows you to select the display mode for entity reference fields. This allows an editor to select from different display modes such as Teaser, Full, or any you add.
It also includes a Selected display mode field formatter which renders the referenced entities with the selected display mode.
Allowing the administrator to change the display of related articles from a grid display mode to a list display mode.Entity Reference Views Select
This module allows you to change your Entity reference fields to be displayed as a select list, or checkboxes/radio buttons in administrative forms. It does this by allowing you to use Views as the reference method, where you can format the results giving the administrator a much better experience.
Showing an icon or thumbnail in a selectable list when referencing a list, or a referenced image.Entity Reference Tab / Accordion Formatter
This cool little module works on both Entity Reference and Entity Reference Revisions fields and provides a field formatter for displaying the referenced entity in jQuery Tabs or jQuery Accordion.
Returning multivalue Paragraphs items in tabs or accordion format.Views Entity Reference Filter
Provides a new admin friendly Views filter for configuring entity reference fields. It allows users to select the labels of the entities they want to filter on rather than manually entering the IDs.
Providing a better admin experience.Better Entity Reference Formatter
This module extends Drupal's default field formatter for entity reference fields in order to make it more flexible by introducing a new field formatter plugin. Along side the view mode option, you can also define the number of entities to return, or a specific entity, like the first, last, or offset them.
Showing the first related product referenced from another product.Entity Reference Validators
The plural in its name suggests more is coming, but currently this module adds a single validator for Entity Reference fields, the Circular reference validator. This prevents you from using the entity reference field to reference itself.
Preventing an entity reference field on node 1 from linking to node 1.Entity Reference Integrity
This interesting sounding module lists other entities that reference your entity.
It also includes a sub-module Entity Reference Integrity Enforce which will attempt to protect entities that are referenced by other entities, and not allowing its deletion.
Protect the integrity of the site by protecting referenced content.Entity Reference Quantity
This module extends the default entity reference field that includes a "Quantity" value in the field definition so you don't have to build a separate entity just to store two distinct fields.
It also includes autocomplete and dropdown field widgets that allow you to select which entity and add the quantity value.
I'll use the example from this great blog on the module: A real world example might be a deck builder for a trading card game like Magic: The Gathering or the DragonBall Z TCG. We want to reference a card from a deck entity and put in the quantity at the same time.Entity Reference Formatter
This module creates a generic field formatter for referenced entities which allows you to select the formatter based on the referenced entity in the display settings form.
When referencing custom entities that don't have view-modes of their own, you would not need to write your own custom formattersPermissions by field
This module extends the Entity Reference field that adds permissions along with the referenced entity. By adding this field, you can manage access to the entities referenced by this field and select permission level (none, view, update, delete).
A lighter version of Organic Groups, or the Group modules.Views Reference Field
In Drupal 8, Views are now entities! Drupal core's Entity Reference field is able to reference Views, however you can't actually reference the Views displays. This module extends core's entity reference module to add the display ID so that a View can be rendered in a field formatter.
Adding a Views reference field to a Paragraphs bundle so you can have a view in and around other paragraph bundles. We implemented this technique in the Bootstrap Paragraphs module.Dynamic Entity Reference
So cool! This awesome module adds the functionality to let you reference more than one entity type. It create a single field in which you can reference Users, Blocks, Nodes, Contact Forms, Taxonomy Terms, etc!
Creating a "related” field, and allowing your administrators to select anything they want.Entity Reference Drag & Drop
This module creates a Drag & Drop widget for the standard Entity reference fields. It provides you with a list of available entities on the left, and you can select them by dragging and dropping them to the list on the right.
Providing a better admin experience.
Thanks to Mike Acklin for his help with this article, and to all the awesome module maintainers and contributors!
This week's longform game article/video highlights include GDC's Indie Summit Failure Workshop, an oral history of NBA Jam, and lots more. ...
On January 27, 2008, the first RC followed, with boatloads of new features. Over the years, it was ported to Drupal 61, 7 and 8 and gained more features (I effectively added every single feature that was requested — I loved empowering the site builder). I did the same with my Hierarchical Select module.
I was a Computer Science student for the first half of those 9.5 years, and it was super exciting to see people actually use my code on hundreds, thousands and even tens of thousands of sites! In stark contrast with the assignments at university, where the results were graded, then discarded.Frustration
Unfortunately this approach resulted in feature-rich modules, with complex UIs to configure them, and many, many bug reports and support requests, because they were so brittle and confusing. Rather than making the 80% case simple, I supported 99% of needed features, and made things confusing and complex for 100% of the users.
Main CDN module configuration UI in Drupal 7.
In my job in Acquia’s Office of the CTO, my job is effectively “make Drupal better & faster”.
In 2012–2013, it was improving the authoring experience by adding in-place editing and tightly integrating CKEditor. Then it shifted in 2014 and 2015 to “make Drupal 8 shippable”, first by working on the cache system, then on the render pipeline and finally on the intersection of both: Dynamic Page Cache and BigPipe. After Drupal 8 shipped at the end of 2015, the next thing became “improve Drupal 8’s REST APIs”, which grew into the API-First Initiative.
All this time (5 years already!), I’ve been helping to build Drupal itself (the system, the APIs, the infrastructure, the overarching architecture), and have seen the long-term consequences from both up close and afar: the concepts required to understand how it all works, the APIs to extend, override and plug in to. In that half decade, I’ve often cursed past commits, including my own!
That’s what led to:
- my insistence that the dynamic_page_cache and big_pipe modules in Drupal 8 core do not have a UI, nor any configuration, and rely entirely on existing APIs and metadata to do their thing (with only a handful of bug reports in >18 months!)
- my “Backwards Compatibility: Burden & Benefit” talk a few months ago
- and of course this rewrite of the CDN module
I started porting the CDN module to Drupal 8 in March 2016 — a few months after the release of Drupal 8. It is much simpler to use (just look at the UI). It has less overhead (the UI is in a separate module, the altering of file URLs has far simpler logic). It has lower technical complexity (File Conveyor support was dropped, it no longer needs to detect HTTP vs HTTPS: it always uses protocol-relative URLs, less unnecessary configurability, the farfuture functionality no longer tries to generate file and no longer has extremely detailed configurability).
In other words: the CDN module in Drupal 8 is much simpler. And has much better test coverage too. (You can see this in the tarball size too: it’s about half of the Drupal 7 version of the module, despite significantly more test coverage!)
CDN UI module in Drupal 8.
- all the fundamentals
- the ability to use simple CDN mappings, including conditional ones depending on file extensions, auto-balancing, and complex combinations of all of the above
- preconnecting (and DNS prefetching for older browsers)
- a simple UI to set it up — in fact, much simpler than before!
- the CDN module now always uses protocol-relative URLs, which means there’s no more need to distinguish between HTTP and HTTPS, which simplifies a lot
- the UI is now a separate module
- the UI is optional: for power users there is a sensible configuration structure with strict config schema validation
- complete unit test coverage of the heart of the CDN module, thanks to D8’s improved architecture
- preconnecting (and DNS prefetching) using headers rather than tags in , which allows a much simpler/cleaner Symfony response subscriber
- tours instead of advanced help, which very often was ignored
- there is nothing to configure for the SEO (duplicate content prevention) feature anymore
- nor is there anything to configure for the Forever cacheable files feature anymore (named Far Future expiration in Drupal 7), and it’s a lot more robust
- File Conveyor support
- separate HTTPS mapping (also mentioned above)
- all the exceptions (blacklist, whitelist, based on Drupal path, file path…) — all of them are a maintenance/debugging/cacheability nightmare
- configurability of SEO feature
- configurability of unique file identifiers for the Forever cacheable files feature
- testing mode
For very complex mappings, you must manipulate cdn.settings.yml — there’s inline documentation with examples there. Those who need the complex setups don’t mind reading three commented examples in a YAML file. This used to be configurable through the UI, but it also was possible to configure it “incorrectly”, resulting in broken sites — that’s no longer possible.
There’s comprehensive test coverage for everything in the critical path, and basic integration test coverage. Together, they ensure peace of mind, and uncover bugs in the next minor Drupal 8 release: BC breaks are detected early and automatically.The results after 8 months: contributed module maintainer bliss
The first stable release of the CDN module for Drupal 8 was published on December 2, 2016. Today, I released the first patch release: cdn 8.x-3.1. The change log is tiny: a PHP notice fixed, two minor automated testing infrastructure problems fixed, and two new minor features added.
We can now compare the Drupal 7 and 8 versions of the CDN module:
- 149 support requests for the Drupal 7 version, with 14 in the last 12 months (the module is stable now after all these years of course) and 83 bug reports over 6.5 years (78 months), with ~6000 sites using it.
- 7 support requests for the Drupal 8 version in the last 8 months and 1 bug report (a bug in a test). With ~500 sites using it.
In other words: maintaining this contributed module now requires pretty much zero effort!Conclusion
For your own Drupal 8 modules, no matter if they’re contributed or custom, I recommend a few key rules:
- Selective feature set.
- Comprehensive unit test coverage for critical code paths (UnitTestCase)2 + basic integration test coverage (BrowserTestBase) maximizes confidence while minimizing time spent.
- Don’t provide/build APIs (that includes hooks) unless you see a strong use case for it. Prefer coarse over granular APIs unless you’re absolutely certain.
- Avoid configurability if possible. Otherwise, use config schemas to your advantage, provide a simple UI for the 80% use case. Leave the rest to contrib/custom modules.
This is more empowering for the Drupal site builder persona, because they can’t shoot themselves in the foot anymore. It’s no longer necessary to learn the complex edge cases in each contributed module’s domain, because they’re no longer exposed in the UI. In other words: domain complexities no longer leak into the UI.
At the same time, it hugely decreases the risk of burnout in module maintainers!
And of course: use the CDN module, it’s rock solid! :)Related reading
Finally, read Amitai Burstein’s “OG8 Development Mindset”! He makes very similar observations, albeit about a much bigger contributed module (Organic Groups). Some of my favorite quotes:
- About edge cases & complexity:
I think there is another hidden merit in tests. By taking the time to carefully go over your own code - and using it - you give yourself some pause to think about the necessity of your recently added code. Do you really need it? If you are not afraid of writing code and then throwing it out the window, and you are true to yourself, you can create a better, less complex, and polished module.
2. About tests:
One of the mistakes that I feel made in OG7 was exposing a lot of the advanced functionality in the UI. […] But these are all advanced use cases. When thinking about how to port them to OG8, I think found the perfect solution: we did’t port it.
3. About feature set & UI:
Unit tests in Drupal 8 are wonderful, they’re nigh impossible in Drupal 7. They finish running in seconds. ↩︎
- AttachmentSize CDN UI module version 3.0-rc2 on Drupal 830.62 KB
TMGMT Translator Yandex
Yandex translator plugin for the Translation Management Tools (TMGMT) project. Allows to submit translation jobs for to Yandex Translator.
About Yandex translation API
The API provides access to the Yandex online machine translation service. It supports more than 70 languages and can translate separate words or complete texts. The API makes it possible to embed Yandex.Translate in a mobile app or web service for end users. Or translate large quantities of text, such as technical documentation.
We finally put a day thanks to a visit from Enzo. We are calling it a "PicNic" and not a camp due to the extend it'll have, it will be two days:
- On Saturday 22nd we'll have an sprint with mentoring
- On Monday 24th there will be technical conferences