You are here

Drupal

SynCal for Drupal 8

Drupal URL: https://www.drupal.org/project/syncal

SynCal provides the ability to synchronize events to third-party calendars such Google Calendar. Supports insert, update and delete operations for node entities that have a date range field.

Requires the Google API Client PHP Library.

The module requires an external library, Composer must be used.

composer require "drupal/syncal"

Using Formulas with Views & Hook Views Query Alter

Requirement: Get a list of store locations within a mileage range.

Setup: A Location content type with fields for the address, zipcode, city and state. Client wanted them separately so using the Location or Geolocation would not have done much for us. Though I only spent less than 30 minutes with each of these to see what they had to offer for what was needed.

Challenge: Perform a mathematical formula in Views using the hook_views_query_alter.

Beans - Create, Preprocess, and Theme.

This is a simple example of code (template) snippets to work with Beans, including the creation, preprocessors, and theming.

For this example I will be creating the Bean through the GUI and locking it in a Feature. This is good for high-paced development, and at least for what I have used Beans for, I haven't had the need to create one programmatically, yet.

Beans turns blocks into an entity, Block Types; which then you can create instances of each block type, have fields, view modes, etc. Just like you would with a content type.

Drupal Best Practices & Standards

Here is a collection of links to great blogs written by some of our best Drupal comrades. I have stumble upon these blogs again and again and have found them very helpful while developing. I highly recommend reading through all these.

48 Essential Drupal Development Tips From Lullabot

This is an awesome collection of Drupal development best practices by Justin Emond at MissingFeatures.com

Interview Questions

These are some of the most common questions I have been asked and ask myself on interviews for LAMP positions. I will update these questions and possibly answer some of them on my spare time.

Something important: If you mention knowing something on your resume, expect to be asked about it.

Drupal

Note taking questions.

Drupal Hooks and Functions I Can't Live Without

Archive of Drupal's Hooks and API functions I constantly use. This blog will be updated regularly since it is used widely for reference.

Cross Domain Access to JSON Data Returned by Drupal's Hook Menu

In this article I will talk about how I access JSON data processed by a Drupal Hook Menu's page callback from a remote domain. The idea here is that sometimes we want to take advantage of Drupal powerful Hook Menu (hook_menu) system to register paths and handle the processing of data for that page request.

HOOK MENU

hook_menu

First, I'll add a menu item so that we can register the path that when access will return an object in JSON format. for this example, I will use the name mymodule to refer to the module where all the code will be saved.

Handle PHP & JavaScript Global Variables in Drupal

Declaring and accessing PHP and JavaScript globals is not as straight forward as I thought it would be. first of all I'm going to go over how I first tried to implement PHP and JavaScript global variables and then what actually worked for me in Drupal 5 and 6.

Handle PHP & JavaScript Global Variables in Drupal

The PHP documentation on global variables - can be found inside the Variable Scope section - implies that if a variable is used within the context of a global variable, then the scope of this variable will span to includes and required files.

Drupal Node API & Node Load

Node Load3>

node_load

Using the node_load function is really cool because it gives you access to all the data associated with a node, but excessive use of this function can be costly. There are several things we must know about what the node_load does.

First, all calls to this function will invoke all the hook_nodeapi functions defined by all modules that have been loaded at that point. The way node_load does this is by invoking the function node_invoke_nodeapi.