DrupalCon News: Drupal in Ireland - Project 5

Planet Drupal - 16 September 2016 - 1:00am

As part of our series of showcasing what Drupal is doing in Ireland, we are happy to bring you another awesome online experience that Drupal has created.  

Project 5 - Dún Laoghaire-Rathdown County Council

Monsoon Consulting worked with Dún Laoghaire-Rathdown County Council to build the next generation of DLR websites and internal intranet platform, using Drupal 7 as the content management system. 

Categories: Drupal

Danny Englander: Drupal 8 Theming: How to Define Variables in Twig Templates to Use as Custom HTML Classes

Planet Drupal - 15 September 2016 - 6:06pm

For the past seven months, I've been designing, building, and theming with Drupal 8 for my own side project. Along the way, I've seen huge advancements in these realms versus what was possible with Drupal 7. One particular module I've been working with is Entity Construction Kit AKA "ECK".

ECK provides a way to create freestanding entities, bundles, and fields independent of traditional means via nodes, terms, users, etc... Within my project, I've implemented ECK fields that offer content editors options for layouts, colors, element padding, and so on.

Discover the array path with kint

I'll use the case of an accordion group entity that I've designed. One such field within this entity bundle is called "Slice margin." This field allows a content editor to set the top and bottom margins within a specific element by choosing values from a select list. Examining this field with kint, the value of the selected item's array path is:

$var['entity']['field_slice_margin']['0']['#markup'] Check for the field and define the variable

Now with the array path value determined, a variable in the accordion entity can be set in a Twig template:

{% if entity.field_slice_margin|render %} {% set margin_settings = 'margin__' ~ entity.field_slice_margin['0']['#markup'] %} {% endif %}

In the above code, the code checks to be sure the field is being rendered and then a variable is set for the value. In addition, margin__ is concatenated (~) as a class prefix.

Set a class using the variable

The block of code above does not do much on its own, so lets put the new variable to use in the template. For that, Drupal 8's Twig set_classes comes in handy.

{% set classes = [ 'eck', 'eck__section', eck__bundle-accordion, 'margin__default', margin_settings|clean_class, ] %}

Note in the above, the new variable is output using the Drupal Twig clean_class method, margin_settings|clean_class. clean_class cleans up any spaces and underscores in a string and converts those to standard dashes for use as a standard html class name.

Output the HTML with the classes

Now that this is done, the class can be rendered in an HTML element in the same twig template using the attributes.addClass(classes) method:

<section {{ attributes.addClass(classes) }}> <ul class="eck__collapsible collapsible popout" data-collapsible="accordion"> {{ entity.field_accordion_reference|field_value }} </ul> </section> Rendered HTML

Finally, this will render in HTML as:

<section class="eck eck__section margin__default margin__flush-above-below eck__bundle-accordion">

The key class rendered here from entity.field_slice_margin is margin__flush-above-below, that's the specific value the content editor chose from the select list on the node edit page. Now this and other values from this field can be used in theming like so using Sass:

.margin { &__default { margin-bottom: 70px; } &__flush-above { margin-top: 0; } &__flush-below { margin-bottom: 0; } &__flush-above-below { margin-top: 0; margin-bottom: 0; } } Summary

As you can see, Twig is really powerful in Drupal 8. No preprocess functions were used here which really helps streamline theming. We stayed within one Twig template for all of the functions and code above. A lot of possibilities here to give content creators more control over layout, colors, custom classes, and more.

  • Drupal
  • Twig
  • Theming
  • Drupal Planet
  • Drupal 8
Categories: Drupal

Steve Jackson Games Previews January Releases

Tabletop Gaming News - 15 September 2016 - 2:00pm
Who here remembers when Spam cans had an expiration date in the year 2000 and we thought it was such a crazy, cool thing? The future will be here before we know it. For example, January. Yeah, we’re almost 3/4 of the way through this year. So that means 2017 is just around the corner. […]
Categories: Game Theory & Design

Solr Query Modification

New Drupal Modules - 15 September 2016 - 1:11pm

The way search is working is excellent for the english language where you split compound words. In e.g. danish or german compound words are written without a space between them which complicates search. Solr Query Modification rewrites the query string with wildcards and fuzzy indicators before it is sent to solr. You can configure the rewrites with the modifications you want.

The module is very simple and is not doing anything you cannot do by hooking into Search API solr search.

Categories: Drupal

Z-Man Games Previews Pandemic Iberia

Tabletop Gaming News - 15 September 2016 - 1:00pm
Having just gotten over being sick the early part of this week, posting a story about a new Pandemic game coming out just seems to book-end the event just fine. Well, this fall, Z-Man Games is coming out with Pandemic Iberia. It’s going to be just a one-print-run game, so if you want to save […]
Categories: Game Theory & Design

Video: 7 ways for game devs to succeed with Twitch streamers

Social/Online Games - Gamasutra - 15 September 2016 - 12:50pm

At GDC 2016, Twitch's Kathy Astromoff shares examples of how game developers are incorporating Twitch streamers into their design process -- and how you can get broadcasters to play your next game. ...

Categories: Game Theory & Design

Cheeky Monkey Media: More than Websites

Planet Drupal - 15 September 2016 - 12:17pm
More than Websites chris Thu, 09/15/2016 - 19:17

We have established ourselves as experts in the Drupal and Web development sphere. However, few people are aware that we bring much more to the table. We are a diverse team of creative thinkers, designers, and marketers with the single-minded desire to make your project a success. It takes more than just building a Website these days, so it's important to us that our clients know that engaging with Cheeky Monkey Media can be a full spectrum experience. 

To help illustrate our hidden talents, we put together this quick little reel highlighting just some of the “Other things we do”, things like graphic design, marketing, and SEO.

Categories: Drupal

WizKids Previews Slash For HeroClix

Tabletop Gaming News - 15 September 2016 - 12:00pm
No, WizKids isn’t doing a Guns ‘N Roses set for Heroclix… though that’d be friggin’ awesome! Anyway, this preview is from the cartoon show. No, not the one I used to watch as a kid. Those were some of the previous previews. This time around it’s the 2012 animated series. We get a look at […]
Categories: Game Theory & Design

Thursday Terrain Corner

Tabletop Gaming News - 15 September 2016 - 11:00am
Hello there, Thursday. How’s things? That’s good to hear. You know, it’s almost time for the weekend. I know, you feel sad because you’re always almost to the weekend, but never there, yourself. That’s gotta be rough. But hey, at least you get to help people make their gaming tables look better. That’s gotta count […]
Categories: Game Theory & Design

Pulp Alley Tomb of the Serpent pre-release deals from Sally 4th

Tabletop Gaming News - 15 September 2016 - 10:00am
Snakes! Why’d it have to be snakes? Well, a lot of people like snakes and they’ve been a part of human culture for a very long time. Take Ancient Egypt, for example. You’ll see snakes all over the place. And it’s into such a tomb, decorated with all manner of snakes, that you must go […]
Categories: Game Theory & Design

Z-Man Games Previews Nautilion

Tabletop Gaming News - 15 September 2016 - 9:00am
I do so enjoy games with quirky themes and interesting stories behind them. Z-Man games is sure delivering with Nautilion. I mean, how often do you get “treacherous Darkhouses” who are looking to take over the “oneiric ocean” and has sent out its “Phantom Submarine” in order to do so via enslaving the “Happy Isles”? […]
Categories: Game Theory & Design

Dr. Strange Team Pack Now Available For Dice Masters

Tabletop Gaming News - 15 September 2016 - 8:00am
Continuing along with the super hero theme… and even with mystical super heroes… we’ve got the Dr. Strange Team Pack for Dice Masters from WizKids. You can run out to the shop and pick up a copy for yourself, if you’re so inclined, since it’s available now. So, what do you get? Lots of things […]
Categories: Game Theory & Design

Finding the fun in game design - by Charlie Cleveland Blogs - 15 September 2016 - 7:31am
Designing a game often feels like finding your game. And yourself. From the designer of Subnautica and Natural Selection 2.
Categories: Game Theory & Design

Resting and XP Boost in Ember - by Jason Zisk Blogs - 15 September 2016 - 7:31am
Discussing how we implemented resting in our RPG, Ember.
Categories: Game Theory & Design

How an NPR story, an Unreal tutorial, and gamer feedback turned into a Virtual Reality blind simulation. - by Christian Allen Blogs - 15 September 2016 - 7:29am
How a VR blind simulation came from a radio show to Virtual Reality.
Categories: Game Theory & Design

Let&#039;s get rid of Steam Keys - by David Jimenez Blogs - 15 September 2016 - 7:29am
Key scammers, key reselling fraud and fake Steam reviews have one thing in common: Steam Keys. Valve has updated the review system, is there anything else that can be done about these problems? How about getting rid of Steam keys altogether?
Categories: Game Theory & Design

The Ugly Truth of Game Prices - by Josh Bycer Blogs - 15 September 2016 - 7:26am
Looking at the state of selling games today, I have some ugly news to report to game designers.
Categories: Game Theory & Design

Nintendo and the mobile market - by Lucas Ribeiro Blogs - 15 September 2016 - 7:25am
Nintendo, game business, mobile, mario.
Categories: Game Theory & Design

Antegods Showfloor Update: No Sleep at Insomnia58 - by Peter de Jong Blogs - 15 September 2016 - 7:21am
As we’re working hard to make our stonepunk arena action game Antegods a reality, we’ll do regular blogposts. This time, lead designer Wytze reports back from gaming festival Insomnia58, where we showed the game to actual gamers for the first time.
Categories: Game Theory & Design

Cubotrox august devlog - by Jose Barbera Pastor Blogs - 15 September 2016 - 7:20am
August was specially marked for our presence in GamesCom, although we only attended the business day it was a very profitable experience. Cubotrox development continued with more levels, fixes and the firsts tests of the game's backend
Categories: Game Theory & Design


Subscribe to As If Productions aggregator