The Media module has really become the de facto standard in handling media files in Drupal 7. I really like the concept of having files (images, videos, etc) as entities. When a file is an entity, you can attach custom fields and modify how the file is displayed by customizing specific view modes.
When you install the Media module for the first time it can be intimidating because there are a lot of moving parts. But if you already have an understanding of how entities, fields and view modes work in Drupal you will get the hang of it pretty quickly.
The Drupal 7 Floating Block module makes it easy to float a Drupal block along the sidebar as you scroll down the page. It uses a simple CSS selector to determine which blocks to float.
In this episode you will learn:
In this screencast we would be learning how to set up the masonry module on a drupal website. Jquery mansory is a dynamic layout plugin for jquery. With this plugin you can achieve a responsive design close to something like pintrest. The creator of masonry David DeSandro describes this plugin as "The flip-side of CSS floats". In other to achieve the desired result, we made use of two modules
1) Masonry Module http://drupal.org/project/masonry
2) Views infinte scroll http://drupal.org/project/views_infinite_scroll
Here is a tutorial on how to setup the views infinte scroll module in drupal. Tutorial
To follow this tutorial, it is assumed you have some knowledge of how to use the views module in drupal.
There was a bug with the masonry module not working with the views infinte scroll module. to solve/fix this issue, here is a link where I got the patches
Get the patch on #3 and #4 and everything should work fine.
It is easy to be overwhelmed with all of the newest front-end tools out there. Below are nine tools and techniques that the themer crew at PreviousNext are using to make our lives easier.
Try as you might to stop it, sometimes it's inevitable. Content editors, RSS import scripts, and other tools result in a designer's nightmare: raw images unceremoniously dropped in node bodies. They clump over to the left, break up the flow of text, force editors to manually tweak the markup of the guilty nodes to keep things looking good. Thankfully, there's a solution for Drupal 7: AutoFloat.
Autofloat is a simple input filter that can be added to any Input Format on a Drupal site, like Full HTML or Filtered HTML. It scours the filtered markup for image tags, adding extra CSS classes that float them, alternating left and right to keep the layout from getting stale.
Autofloat can also be configured to do its processing but leave out the custom CSS rules, add extra classes to the images it detects, or ignore images that already have custom CSS classes assigned. The result is a handy tool that can prep manually-inserted images for your own custom CSS, without its own styles getting in the way.
I was working on a Drupal migration project today using the Migrate module where I needed to import only select user roles from the source (Drupal 6) database.
The Migrate module allows for a custom query to select only the user roles that need to be imported. In my case, the two roles I wanted to import had role IDs of 4 and 6. So, how do I write a query using the Drupal Database API to do this? Turns out there's a pretty elegant answer. Rather than writing something like:-->
We recently implemented a new feature on top of BASSTrakk, (provided by B.A.S.S, BASSmaster.com) that maps out the location of all angler’s positions and catches on the lake during a tournament. The underlying goal of this new feature is to further engage spectators in the sport of bass fishing and provide additional coverage and statistics beyond what can be acquired through typical televised coverage.
To achieve this, we needed a solution that is performant under heavy traffic, provides rich interactivity with the data gathered from the tournament, and is also highly maintainable for future enhancements and adjustments. The success of this solution would depend on choosing the right map vendor.
Choosing a vendor to fuel pieces of functionality on your site is kind of like marriage. It is a very difficult decision, and once you say yes, it is often very hard to get out. While some features are relatively simple to swap out without too much sweat (e.g. traffic tracking services like Google Analytics and Chartbeats), other vendors require a huge game plan if you need to switch over to a competitor.
Map vendors provide their own unique API interface to allow developers to use their map layers and plot markers, labels, shapes and other objects on the page elegantly without too much custom work. However, the problem I saw with this is that, when it comes time to migrate to another source, you will also have to convert the code you custom-tailored to that vendor, as well, making the transition expensive. If there’s a chance that the vendor experiences downtime or fails at some point in the future, you’ll be forced to make the transition whether you have the time and resources when it happens.OpenLayers to the Rescue
OpenLayers itself does not provide the map tiles. It is more of an abstraction layer that adds functionality to map tiles. Regardless of what source you use, you still have to load libraries provided by the map vendors. Beyond that, there is no need to refer to their API to add markers, lines, objects, and more on the map as such functionality can be developed broadly across all sources within OpenLayers.
Mapbox for High Traffic Loads and Beautifying Map Tiles
For this project, we decided to use Mapbox (developed by Development Seed) to provide custom-designed maps to the end user, even under heavy traffic. Some custom development may be done in Mapbox (e.g. removing labels on the map, changing the texture and colors of map objects) within the account.
However, the major advantage Mapbox has over most other vendors is that it allows developers to design the map however they would like (want to make the water purple? Remove all lakes and ponds from the map? Change the font of the labels?). This can be done using TileMill, an application that lets you design your layers locally. You can use your creation in TileMill to serve maps within your Mapbox account.The End Result?
The map was presented to spectators during the BASSmaster Classics, the sport’s biggest event of the year. Despite competitor’s concerns over the new feature, public engagement in the sport increased dramatically. The new feature allowed spectators away from the event to locate their star angler’s current location as well as the location of the catches versus their competitors. This is more coverage than what BASSTrakk previously provided, which was a consolidated count of each angler’s fish count.
Mapbox held up to serving over a million map views every day during the tournament without failure. That, and the ability to modify the map layers easily during the final stages of the project gave us bandwidth to focus on more important features rather than going through third party documentation and potentially having to contact the map vendors themselves for a solution. Taking the time to find the right map vendor for our project was well worth
Top7news is a news aggregator that operates automatically by gathering and archiving the RSS feeds from several Greek news sites, providing a functional and easily accessible front end for the user to read through the latest news.
The database is there, it has values, surely they are the values that needs to appear. Hooks, controller classes and the like are just slowing you down, why use them? I do not even know why we even bother with Drupal 8 if this mindset is still prevalent.
Last week Phase2 launched their new site and blogged about it. As a company that is mainly focussed on Drupal, they made sure to add few paragraphs on the fact that their new site is not Drupal, and that they decided to use Wordpress.
In this article, I’m going to show you a few methods to separate your public site from the vulnerable parts of your administration area. What you need is an effective way to keep your site locked and secure, and protected from attacks, while still leaving your site editable for trusted users.
Our Views plugin challenge has just finished, and we got some great submissions for you to check out.The Challenge
Thank the good lord for Views (which is now in Drupal core!). If it wasn't for Views, we'd be writing custom queries to list data all the time. Sometimes, though, Views doesn't do exactly what you need it to do, and when that happens you'll have to create either a handler or a plugin. Views has 10 different types of plugins! For this challenge, you pick any type you want, and create something useful. The submission that does something useful and is well explained in a screencast / text gets the win. Get crackin'The Winner
We had a few great submissions, but Mike Miles submitted an excellent module and accompanied it with an excellent description / screencast, which is why he's taking home our prize. Mike created an access plugin for views that uses a taxonomy reference on the user to control whether the user can see a view. His code and explanatory screencast are definitely worth checking out. There are two other great submissions that you can learn from as well. Mike earned himself a free year of hosting from DreamHost. Congrats!
Here's Mike's screencast so you can see the module in action:Coming Up: Drush!
Our next contest calls for submissions with examples of Drush craziness. We want to see cool Drush integration for existing modules, new global drush commands, or even helpful drush scripts that you use in your workflow. Check it out!Tags: Drupal Planet
I've just ported one of my D7 modules, Views Contextual Range Filter, to D8. Phew! That took longer than I'd hoped.
In terms of the effort, I'm not referring to us developers having to convert our .info files to .info.yml files. Or that for configuration variables our trusty mymodule_settings() function now needs to return system_config_form($form, $form_state) and that we have to do the saving of our config variables ourselves in another function, using the new API that came out of the CM initiative.
Those were the obvious and the easy bits.
I'm talking Views.
At the time of writing, nothing in this lovely porting tutorial prepares a developer for what they'll face when they port a D7 module that interacts in a big way with Drupal's biggest module, Views.
Views, blocks and the config stuff have plunged deeper into OO through Symfony.
If you're an ex-Java developer like me, then for Symfony read Spring (dependency injection, annotations etc) and you should be right… after the initial shock ... And after a few days of poking, trying to figure things out and reworking your code.
If you only know enough OO to get by in D7, then brace yourself for a brush-up. Big time. Expect to see more of the :: symbol and of that function return chaining thingy (->) so popular in Ruby. If you don't know what I'm talking about, then you're getting my point exactly.
With CTools gone and Views Symfonised, we're not just talking symbols and name changes here. Most of your D7 Views code will be broken: your handlers, plugins, argument code… pretty much everything… Some D7 hooks are gone. Some View data publicly available in D7 is now protected, so new access functions are required to get to it and manipulate it.
Finding where to start can be a daunting task in itself. Your D7 class views/handler/views_handler_argument_numeric.inc for instance, looks and feels different and lives in core/modules/views/lib/Drupal/views/Plugin/views/argument/Numeric.php. Makes sense? Not to me either. Not at first.
With their Symfonication, the new Views parts have also adopted CamelCase notation rather than lowercase plus underscores. Yep… We now have double coding-standards. What is the Coder module going to recommend, I wonder?
The good news? Revisiting your old code is an opportunity to get it right the second time. And Symfony is cool.
So, coming out at the other end of that tunnel, your code does shine a little brighter. Cleaner. And ready to take on the future.
RikFile under: Planet Drupal
Yes, you read it right! Now you can create personal lists of Drupal snippets at Dropbucket.org - Drupal snippets repository. It turned out that we already have loads of great snippets at the website and there challenge have appeared: how to group these snippets in some convenient way? So for example, you found five cool snippets about theming and you could add them to your bookmarks, but later, you can lose track of them because you're constantly adding other snippets to your bookmarks and sooner or later you can simply get lost in your bookmarks feed.Read on about Now You Can Create Personal Lists of Drupal Snippets at Dropbucket
by Aaron Froehlich
*Feel free to browse the code from this tutorial in my sandbox repository at Drupal.org.
This tutorial is a follow-up to a recent article on Minimalist Drupal Development, where I made the case for judicious module selection as a strategy for keeping Drupal sites more performant and enjoyable to code. In this tutorial, I'll demonstrate how to create a Twitter timeline block using the Bean API. Ironically, a similar module appeared recently, called "Twitter Timeline" and released by Tom Kirkpatrick. The main difference here is that this solution relies on Drupal's cache and our own custom output rather than Twitter's widget system....
New contributors to Drupal 8 do not need to have a local development environment running Drupal 8 in order to contribute.Options for contributing without running Drupal 8 locally:
I really want to compile other blog posts and documentation pages on running Drupal 8 locally. For now, here are a few pieces of information that will be helpful.
If you search around and try a few things, but run into trouble getting Drupal 8 to install on your local system, or you install fine, but test do not pass locally, then open an issue and tag it "d8 dev environment".
In this screencast, we would learn how to install and configure the imce-wysiwyg bridge module.
What is the advantage of this module? Say for example you are making use of the WYSIWYG module on your drupal site, you find out it is diffuclt adding an image to your content if you are not an experienced drupal user, since this requires using the correct url. With the imce wysiwyg module, you can simply browse files on your server or uplaoding a new file using a dialog and then selecting what file you would like to upload/use in your content. This is an easier and better way of adding images to your content especially if your drupal site user in a novice at using drupal.
This tutorial assumes you already have the knowledge of how to install and configure the WYSIWYG module. In case you do not know how to, here is a link for doing that. http://www.expresstut.com/content/using-wysiwyg-drupal
Recently I needed to create a calendar view of nodes that had a date field (with start/end dates). After researching my options, I came to the conclusion that I had the following choices:
The first option looked promising but I quickly found that it didn't quite fit my needs. The calendar needed to be able to show nodes of different types (events/tasks that also used different fields for their dates) and this was simply not possible using Views (could be wrong but I doubt it).
The second option offered more flexibility but also meant I'd have to build/theme a calendar from scratch and honestly, who wants to do that?
In the end, I went with the third option which allowed me to build the query how I needed while relying on the handiwork of a jQuery plugin to make it pretty. I decided to use Adam Shaw's excellent FullCalendar jQuery plugin since it's dead simple to use and offers a myriad of options to help suit your needs.
Here's a basic overview of how I got things set up.Installing the FullCalendar plugin
Next, in my custom module I created two page callbacks (one to display the calendar, the other to be an ajax callback that FullCalendar uses to populate events.
In the second callback I use EntityFieldQuery to get the data I need, then return the data for each event/task. Note, I'm pasting the code directly from my module as-is for reference but you'll need to adapt what I've done for your own needs.
All in all, the combination of EntityFieldQuery, the fullCalendar jQuery plugin, and a little bit of putting it all together made it rather easy to accomplish what I was after. I hope this helps to show how easy Drupal 7 makes it to do things like this. Feel free to leave a comment with any questions or suggestions.
Until next time!See Also
Here's a list of references that might help explain some of the concepts I didn't delve into here:
The documentation for CRM Core has been updated on Drupal.org. Now that the module has achieved a stable version, we have updated most of the information available about how to use it.