Skip to content
lapistano edited this page Nov 16, 2012 · 6 revisions

Getting started

Obtaining sources

There are a number of ways to get your hands on the sources of this module. Probably the most easy way is to use packagist.org. Since packagist uses composer to manage dependencies between libraries the connector should be listed as requirement.

"require": {
    "liip/drupalconnectormodule": "*"
}

Once added run composer to receive the sources.

$> php composer.phar install

Using the connector

This section is just a basic introduction. Visit the wiki for an extensive example.

The following code snippet represents a Drupal file (e.g. myModule.module).

<?php

use Liip\Drupal\Modules\DrupalConnector\Common;
use Liip\Drupal\Modules\DrupalConnector\Node;

function myModule_doSomething($nid)
{
    $commonConnector = new Common();
    $nodeConnector = new Node();

    try {
        $node = $nodeConnector->node_load($nid);

    } catch (NodeException $e) {

        $commonConnector->watchdog(
            'myModule',
            $e->getMessage(),
            array($nid),
            WATCHDOG_ERROR
        );
    }
}

That's basically how the connector works. Just add it to your project and use it accordingly. No magic ;)

Clone this wiki locally