Category: drupal 7

Six months ago or so it clearly stated in the Drupal docs to NOT create D8 modules do to the API not being finished. But still right and left there were people developing and porting D8 modules, clients were asking for it as experience and there was a log of hype. I decided to try my hand at it and had a working module as of 6 months ago. When I finally got GIT access 6 months later to push my changes to Fancy Login, It had stopped working on the latest D8 build. This article covers the latest changes to the API made during this period and the changes I had to make to do last minute API changes.
module Fancy Login.

1. moved file FancyLoginSettingsForm.php from folder fancy_login/src to fancy_login/src/Form folder

2. in FancyLoginSettingsForm.php file changed translate functions functions t(). for example

t('Text !url.', array('!url' => 'background-

color')) to t('Text background-color', array('@url' =>

'http://themeshift.com'))

3. Moved the function user_login_block_ajax_callback from file FancyLoginSettingsForm.php to

fancy_login.module file.

4. Moved libraries such as

Drupal\Core\Ajax\AjaxResponse;

Drupal\lightbox_login\Ajax\lightboxLoginRefreshPageCommand;

Drupal\lightbox_login\Ajax\lightboxLoginRedirectCommand;

from FancyLogin_loginForm.php file to fancy_login.module file.

5. Deleted library

I have been building apps recently that integrate a REST API which subscribes users to a Drupal web app via SMS, they are simultaneously subscribed in the telecom operators database. Conditions must be checked to keep the users status in sync with Drupal and the operator. Other conditions that I won’t cover here include recurring billing or the free trial period.

This is a practical example of how using the REST protocol allows technologies that are completely different to communicate with each other. The technologies in our stack include SMS, mobile billing and a Drupal web app.

First create the URL endpoint with a callback function by using hook_menu

function my_module_menu() {
$items['my_url/send'] = array(
'title' => 'send',
'page callback' => 'my_module_send_page',
'access callback' => TRUE
);
return $items;
}

Continue Reading..

The services module comes built into core (standard issue), with Drupal 8, the next generation of Drupal. This shows incredible insight in the Drupal community as we had toward a RESTful web connected through APIs. There are a variety of methods to convert a Drupal or WordPress app to a native app that can be purchased on the iOS and Android app stores. The most complex of which, but which also result in the most native feel would be as follows.

View our conversion service.

Continue Reading..

Multi lingual sites is a desired feature for sites targeting audiences of multiple countries or of more than one linguistic groups for example my first experience with the module was translating the Wanderlust Festival website for audiences in Quebec, where French and English are national languages. For Drupal there are many features which streamline the process. We will go into some of the standard translation techniques. In a later post I will go into identifying and translating certain hard to target strings such as those in complex views.
Continue Reading..

Preface

Our fourth  multilingual site and significantly more of a challange.  When in the past I had dealt with latin alphabet only, this time I was dealing with Arabic and there were some major differences here. In the Arabic language everything reads right to left. So through simply checking a setting in i18n admin panel you can add the attribute dir="rtl" to the <html>  tag. This conveniently moves all your content to the right side of your page and changes text highlight from this direction as well. This caused quite a few issues mainly with CSS.   Sprites were off on the Arabic version by a few px, but luckily this was easy to fix, as Drupal adds the class i18n-ar to the body tag, so it was easy to target Arabic only views. One other major issue I had was a large left margin of > 1000px when language was set to Arabic, this was fixed by setting body tag to overflow:none;

Translating Fields and Taxonomy

Need to control which users can access a node/page of a particular content type on your Drupal site?

The Drupal Node API provides us a quick way to do this. It provides the hook_nodeapi function to react to the actions affecting all kinds of nodes. We can easily implement this hook in our module or theme. A prototype of this hook looks like this:

function myCustomModuleName_nodeapi (&$node, $op) {

/*Your code and conditions here*/

}

Here myCustomModuleName is the name of the module in which this hook is defined. The two parameters are $node, which represents the node on which the action is being performed and the other one $op,  is the kind of action which is being performed. The $op can have values like view, alter, delete, print and so on…

As an example, I was looking to design such a condition for my website:

  • If enrolled user creates content type for "recipe", restrict access to recipe except for node author and admin.

So, I needed to develop a mechanism through which for each node of type “recipe”:

  • Everyone can see nodes created by admin including Anonymous user.

Contact

office: (212)-658-1447 | cell: (914)-715-8862 | alex@freeenergymedia.com

Name
Email
Message

Message sent, Thanks!
Error! Please validate your fields.
2017 FEM NYC (formerly Free Energy Media)