Newsfeeds Blog: Nasty PHP7 bug exploit in the wild

Planet Drupal - 7 November 2019 - 3:26am
New PHP7 bug CVE-2019-11043 can allow even non-technical attackers to take over servers.
Categories: Drupal

Ckeditor Link With Text

New Drupal Modules - 7 November 2019 - 1:45am

This module is an extension to the CKEditor module.

This module provides the hyperlink text field with the link.
When you enable this module it provides a new link field with a text interface.

Categories: Drupal


New Drupal Modules - 6 November 2019 - 10:38pm

Use HTTP/2 Server Push to create fast and idiomatic client-driven REST APIs

Categories: Drupal

Google Text to Speech

New Drupal Modules - 6 November 2019 - 10:33pm

Text to Speech module uses Google Cloud Text-to-Speech library which allows you to convert words and sentences audio data of natural human speech. You can then convert the audio data into a playable audio file like an MP3. The Cloud Text-to-Speech API accepts input as raw text or Speech Synthesis Markup Language (SSML).

Categories: Drupal

Cyborg translate

New Drupal Modules - 6 November 2019 - 6:43pm

Cyborg translate allows part-human, part-machine translations.

Very rudimentary right now and for the foreseeable future: It triggers Google translate and Drupal interface translation at the same time, allowing sections of your site's localization to be done by humans and the rest by machines.

To use, enable and then place Drupal core's Language switcher, if you hadn't already.

Categories: Drupal


New Drupal Modules - 6 November 2019 - 12:54pm

Integration module with MATH-PHP - Powerful Modern Math Library for PHP.

The only library you need to integrate mathematical functions into your applications. It is a self-contained library in pure PHP with no external dependencies.


Categories: Drupal


New Drupal Modules - 6 November 2019 - 11:52am

This module provides a service for interfacing with Cinderella.

Cinderella is a RESTful asynchronous task and task scheduling service.

Categories: Drupal

Lullabot: Custom Layout Options in Drupal 8

Planet Drupal - 6 November 2019 - 9:52am

Like most CMS products that provide structured content modeling tools, Drupal excels at building template-driven pages with consistent layouts. A blog post might use one template and a staff bio another, but as long as the basic shape of the page is consistent, Drupal's traditional content modeling and page composition tools are usually enough. When it comes time to build special content, though—departmental portal pages, landing pages for ephemeral marketing campaigns, editorial curated topic hubs, and so on—Drupal's combination of templates and structured content can fall short.

Categories: Drupal

InternetDevels: Shopping cart usability & Commerce Cart Flyout Drupal module

Planet Drupal - 6 November 2019 - 8:22am

Shopping cart is a vital place in your online store where the “moment of truth” often happens — the customer either proceeds to checkout or abandons the purchase.

The situation can be changed in favor of option 1 if you increase shopping cart usability. Among nice Drupal 8 shopping cart modules, we would like to discuss one today. Its name is the Commerce Cart Flyout module in Drupal 8, so let’s see what it does in the usability arena.

Read more
Categories: Drupal

Format Bytes

New Drupal Modules - 6 November 2019 - 8:19am

Provides a Twig Extension, that you can use in your Twig Templates. In twig when you get the value of a file, the size is in simple bytes and if you're intending to show it to your end-user, it's not user-friendly, this simple Twig filter helps with that and renders the file size in it's respected: 'B', 'KB', 'MB', 'GB', 'TB'


{{ node.field_attachment.entity.field_file.entity.filesize.value | format_bytes }}

Categories: Drupal

Centarro: Commerce 2.15 adds invoicing, VAT number handling, and Drupal 9 readiness

Planet Drupal - 6 November 2019 - 7:42am

We had a great time at DrupalCon Amsterdam last week introducing the European Drupal communtiy to our new brand, our near term product roadmap, and our recently launched support offering. It's always encouraging to hear from the many active individual and agency contributors in Europe, and the broad interest we received in Centarro Support validated our approach for providing fast, professional support in a dedicated channel.

Categories: Drupal

Mutazione - Is it my Genre? Trailer Analysis - by M. Joshua Cauller Blogs - 6 November 2019 - 7:27am
A trailer breakdown of Mutazione is the best way I know how to start discussing genre in game marketing.
Categories: Game Theory & Design

Why developers love the Nintendo Switch as much as gamers do - by Elijah Freeman Blogs - 6 November 2019 - 7:19am
Virtuos worked with Bandai Namco, Ubisoft, and Obsidian on co-developing Dark Souls, Starlink, and The Outer Worlds for the Nintendo Switch respectively. Andy Fong, Studio Technical Director at Virtuos, gives his top tips on developing games for Switch
Categories: Game Theory & Design

Xbox One and PlayStation 4 - Still Worth Buying? - by Brandon Perton Blogs - 6 November 2019 - 7:18am
After E3 2019, everyone seems to be talking about what the next generation of consoles might bring, how Google Stadia will influence the market, and how excited they are for the future of gaming.
Categories: Game Theory & Design

Battle royale in Q3: Game for Peace dwarfs its competitors as Fortnite on iOS decays for fourth consecutive quarter - by Louise Shorthouse Blogs - 6 November 2019 - 7:16am
Following its strongest quarter in Q2, the mobile battle royale segment outside of mainland China is showing signs of weariness.
Categories: Game Theory & Design

10 Actionable Tips For Your Chinese Video Game During Singles' Day - by Dolly Dai Blogs - 6 November 2019 - 7:13am
We only hear about Valentine’s day but what about Chinese Singles’ Day? It was launched 10 years ago as an excuse for e-commerce to squeeze extra sales. Now, it’s one of the highest revenue-generating days in China in most industries. Follow our rec
Categories: Game Theory & Design

Niantic opens Niantic Creator Program to fund and support AR-minded devs

Social/Online Games - Gamasutra - 6 November 2019 - 7:02am

Pokemon Go developer Niantic has unveiled the Niantic Creator Program, a multipronged initiative that aims to support developers working in real-world augmented reality. ...

Categories: Game Theory & Design

Graphql field views arguments

New Drupal Modules - 6 November 2019 - 6:54am

This module provide new field type for any content entity which can render a views with the fields of entity injected as arguments.

For example, if you need to get first the value of your field to send it in your second request as arguments of views; you can use this module to do only onerequest.

In addition you filter by a field of a parent current entity, for example if your entity is an paragraph you can filter with the field parent value.

This features has been designed for GraphQL API, also not working if you are not decoupled.

Categories: Drupal

Joachim's blog: Debugging and Logging AJAX requests tests in Docksal

Planet Drupal - 6 November 2019 - 6:30am

The hardest thing I find with tests is understanding errors. Every time I think I've got debugging output sorted, I find a new layer where it doesn't work, I've got nothing, and I'm in the dark with something that's crashing and I don't know why.

The first layer is simple: errors in your test code itself. For example, make a typo in your tests/src/Functional/MyTest.php and PHPUnit crashes and you see the error in the terminal.

But when it's site code that's crashing, you're dealing with a system that is being driven by code, and therefore, you can't see it. And that's a major obstacle to figuring out a problem.

The HTML output that Drupal's Functional and Functional Javascript tests produce is a huge help: every time your test code makes a request to the test site, an HTML file is written to the test files directory. If your site crashes when your test makes a request, you'll see the error and the backtrace there.

However, there's no such output when in a Functional Javascript test you cause an AJAX request. And while you can create a screenshot of what the page looks like after the request, our another HTML file of the page (see for instructions how; the issue is about how to make that automatic but I have no idea how that might be possible), you can't see the actual error, because AJAX requests that fail just sit there doing nothing. There's nothing useful to see in the browser.

So we need to see logs. When a real site has an AJAX crash, with a human being-controlled web browser making the request, you can go and look in the logs. With a test site, the log table is zapped when the test is completed.

Fortunately, Drupal 8's pluggable logging means there are other ways of getting hold of them, more permanent ways.

I first tried log_stdout module. This outputs log errors to STDOUT. If you're running on Docksal, as I am, you have an extra layer to get though to see that. You can monitor the cli container with fin logs -f cli, and with that module add a | ag WATCHDOG to filter.

However, I wasn't seeing backtrace in this output, and I gave up figuring out why.

So I tried filelog module instead, which as the name implies, writes log to a simple text file. This needs a little bit more work, as by default it writes to 'public://logs'. This means that each run of the test gets its own log file, which is perhaps what you want, but for my own uses I wanted a single log file I could tail -f in a terminal window and have continual monitoring.

A quick bit of config setting in the test's setUp() does the trick:

$this->config('filelog.settings') ->set('location', '/var/www/docroot/sites/simpletest/logs') ->save();

And I think that's me at last sorted.

Tags: debuggingtestsdrupal planet
Categories: Drupal Making product images consistent with image styles

Planet Drupal - 6 November 2019 - 6:22am

We’ve recently given the site a new face lift and stumbled across an interesting problem during development when it came to implementing the new product carousel on their product pages, more specifically, the handling of the images themselves.

The design brief stipulated that the transparent studio style product images required a light grey background behind it, giving the impression of a product floating nicely in the middle of a light grey surrounding.

We had 2 problems here:

1. A lot of the studio style product images didn’t have sufficient transparent space around themselves and we ended up with unsightly results; images would be touching the edges of its container and weren’t sitting in the middle as intended. We needed to cater for these types of images.

2. We have a mix of studio and lifestyle shots. We couldn't just apply the same image style to both types of image; we would have to come up with something magic/clever to distinguish a studio shot from a lifestyle shot and then apply an image style accordingly.

Given that we are ComputerMinds (we massively care about our clients and we love a challenge) and knowing that the client would have to manually go back, edit and re-upload thousands of images, we decided if would be cool if we could come up with a code solution for them. Below is a brief outline as to how we achieved a code solution to a design/content problem. Enjoy!

Our concept was pretty clear; for images that had at least 1 - and no more than 3 - edges that contained transparent pixels, apply a Drupal image style with a custom effect that would “pad” out the image. The idea was, if an image has 4 transparent edges, the image had sufficient space around it. If it had no transparent edges we knew this was a lifestyle product shot, i.e a radiator in a lounge.

I started looking at the possibilities of detecting transparent pixels with PHP and came across a handy function from the PHP GD image library called imagecolorat(). Using this function and some hexadecimal converter madness (please don't ask me to explain!), we can detect what type of pixel we are looking at given a set of coordinates.

// The result of $transparency will be an integer between 0 and 127 // 127 is transparent, 0 is opaque/solid. $rgba = imagecolorat($image_resource, $x, $y); $transparency = ($rgba >> 24) & 0x7F;

Now we needed to run this function for every pixel along on all four edges. So, first things first, grab the image width and height and subtract 1 from the result. Subtracting 1 ensures you won’t hit a PHP notice about being “out of bounds” - we’re not playing a round of golf here :). Next, we need to sort out our coordinate ranges for us to loop over:

// Top side X = 0 Y = $image_width // Bottom side X = $image_height Y = $image_width // Left side X = $image_height Y = 0 // Right side X = $image_width Y = $image_height

For each permutation of coordinates (x=0, y=750, x=1, y=750, x=2, y=750 etc) , we simply check each pixel result from imagecolorat() and save the result to an array for us to check later on. Once we have detected a transparent and a non-transparent pixel (remembering to check our magic number 127), we then break out because we have all the information we need from this particular edge.

After you’ve completed this process for all four sides, we then do a simple check to see we have a mix of transparent and non transparent pixel edges. If we do, then we pass the image along to our custom image style for processing.

Our custom Drupal image style uses the “define canvas” image processor from the contrib module imagecache actions. We define our own image style effect but use imagecache_actions’ “define canvas” processor to transform our image. This is where we add X amount of pixels to increase the “padding” around the image.

In order to create a custom Drupal image style, we would need to implement hook_image_effect_info() and place any effect code into the "effect callback". See below for an example.

/** * Implements hook_image_effect_info(). */ function MY_MODULE_image_effect_info() { $effects = array(); // Remember to replace MY_MODULE with the name of your module (in lower case). $effects['MY_MODULE_transparent_padding'] = array( 'label' => t('Transparent padding'), 'help' => t('Applies padding if an image has a mix of transparent and solid pixels around the edges of an image.'), 'effect callback' => 'MY_MODULE_transparent_padding_effect_callback', 'form callback' => 'MY_MODULE_transparent_padding_form', 'summary theme' => 'transparent_padding_summary', ); return $effects; } /** * Callback for MY_MODULE_transparent_padding image effect. */ function MY_MODULE_transparent_padding_effect_callback(stdClass $image, array $data) { if ($image->info['mime_type'] == 'image/png') { $image_height = ($image->info['height'] - 1); $image_width = ($image->info['width'] - 1); $image_resource = $image->resource; // Do the coordinate magic and determine transparent and non transparent pixels // Build up $data array (this will contain background colour and amount of pixels - // to pad out the image. // Use imagecache_actions custom effect "define canvas" and pass in your $data array. $success = image_toolkit_invoke('definecanvas', $image, array($data)); return $success }

Below is the result of our custom image style effect settings form as defined above in hook_image_effect_info via "form callback". (The form was taken directly from imagecache_actions' definecanvas effect where I made a couple of edits - so credit goes to them)

And the result is shown below: a before and after. Much better! Furthermore, we’ve saved the client from having to manually edit thousands of images and then manually re-upload them. Win win!



Categories: Drupal


Subscribe to As If Productions aggregator