You are hereDrupal 7

Drupal 7


Getting user location on mobile phone or desktop and passing it to views filter

So this is not the cleanest thing possible and maybe some views filter should be made but I created it mostly for the purpose of adding extra button to search a search api index data with user current location. What maybe somebody doesn't know is that you can get user location with html5, so you will only need some little code and I also used reversed geocoding to get address from google api because I already have a filter that uses geocoded data.

Creating custom facet block for Search Api Location module

Facets work fine and by design they narrow down the search results with each facet option you click. But what happens when you want to make them work differently. Some of that can be achived with changing opearator to OR in facet settings. But in this case with search api location module this doesn't work, not sure is it a bug or by design but I solved that with creating my own facet block.

Solr Search Api, search Title as fulltext and sort as string

Currently if you use SOLR for search and deploy it with search API module you can index Title field as fulltext so you can make better use of it and find parts of it when searching. But then you can't sort by title in search api sorts module, what to do? Well use

Install xDebug with Sublime for Drupal (Mac, PC, Windows or OSX)

I'll try to make this quick. Installing xdebug for drupal is the same as installing it for anything else like wordpress etc

So what you need to do is to get xdebug to your php folder. This is different depending on system you use, for example OSX has it already when you install MAMP so you will just need to enable it. Go to your php.ini file and find XDEBUG part and active it(remove comment from zend_extension) and add some lines below like, but probably would even work without them, maybe just include first line.

zend_extension=/usr/lib/php5/20100525/xdebug.so

Check if user is part of OG group

if (og_is_member('node', $current_group->nid , 'user', $account)) {

Seems that lates og_is_member needs 4 parametars when checking if user is part of the group, not 3 like it is written in most posts online, so you can get it like above.

Using VBO to copy and paste fields inside a node, using field collections and node/entity reference

You can create VBO actions that can do something for you but for a quick solution and one time actions you can use "Execute arbitrary PHP script" and there you have $entity and $context object that you get one per each line of yout VBO view.

So what I did was copy some text and node reference fields to field collections fields, that have text and entity reference in them. This took a little bit more coding and clever thinking but with google and some help of this page
https://drupal.org/node/1842304

Views doubt: make a template or style in interface

Views has many options. You can change styling and structure of rows of data in interface of with templates. When I first started using views I choose templates, partly also because of not so much power in UI, but now you can do almost anything with UI. But after using UI, I would still recommend templates.

Database syncing over drush

This has been a long wish for me. Sync databases online and on localhost.

There is an add on for drush that does that
https://drupal.org/project/drush_sql_sync_pipe

Of course this didn't run smoothly and needed some extra config. First SSH didn't work correctly on connecting to remote server, and then MySql also had a problem with the same solution, they were both just needed to be added to windows enviroment, eniroment variables to be exact.

So

New Age sliders and carousel (Responsive)

After using views slideshow and jCarousel (and not so happy the way they work, mostly in theming department) there are new players in town and they are even responsive. Also easy to theme and easy to setup.

https://drupal.org/project/flexslider
https://drupal.org/project/owl-carousel

Flexslider is great for slideshows, they can even pull carousels but for great responsive carousels use the owl carousel. Just a note, owl for drupal is pretty beta, so you will need to use dev version and also use jquery update 1.8 version, otherwise you may end up with empty space in place of carousel.

Omega 4 and Compiling Sass on Windows (how to install and make it work)

I know Sass and Less are major improvements in Css coding, but setting all this up is a drag. I was using Omega 4 and to style it we need to use Sass coding. There are enough resources out there, but they are often limited to some special use case scenario and as there are many components to make it work you will have problems when trying to set it up. So after a day of work I finally pulled it off and made this Sass thing work and auto compile to Css.