Emerald restrictions are based on adapters. There might be adapter for every joomla extension. On the moment I write this article there is only 2 adapters available.
Adapters are stored in components/com_emerald/library/rules. Every adapter match extension name like com_content or com_cobalt. WHen you select extension to restrict from dropdown list, Emerald look for adapter for this extension based on extension name, and if special adapter is not found, universal default adapter is used.

Let’s say we want to create adapter for com_weblinks extension. So we have to create com_weblinks folder and com_weblinks.php and com_weblinks.xml files in it. And language file. Here is the list of all files.
XML file is very important. It is used to generate restriction rule form (see pic. yellow).
<?xml version="1.0" encoding="UTF-8"?>
<form>
<fields name="rule">
<fieldset name="rule" description="WL_DESCR">
<field name="cat_id" type="category" default="0" extension="com_weblinks" label="WL_CATS"/>
</fieldset>
<fieldset name="count" label="X_COUNT_LIMIT" description="EM_COUNTLIMITDESCR">
<field name="count_limit_mode" type="list" default="0" label="X_COUNT_LIMITMODE" description="X_COUNT_LIMITMODEDESCR">
<option value="0">XML_OPT_DONOTCOUNT</option>
<option value="1">XML_OPT_COUNTUNIQUEURLS</option>
<option value="2">XML_OPT_COUNTEVERYACCESS</option>
</field>
</fieldset>
<fieldset name="core" label="EM_CORE">
<field name="count_limit_mode" type="radio" class="btn-group" default="0" label="EM_COUNT_USAGE">
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>
<field name="message" type="text" multiple="true" label="EM_RESCR_MSG" default="You cannot access this page"/>
</fieldset>
</fields>
</form>
<fieldset name="count"> is a required group of parameter.category element type to create dropdown list of all Weblinks categories.multiple="true" and select multiple categories.<fields> element have to have rule name attribute.<fieldset name="core"> is required set of parameters for every rule.<fieldsets> elements as you which. In fact if you have many parameters, it is even highly recommended to keep them organized and easy to use.<fieldsets> attribute description to add general information about this restriction rule adapter (see pic. green).
How edit language file and add there
WL_DESCR="This rule restrict access to weblink catalog by categories."
WL_CATS="Category"
WL_HINT="Restricted category <b>%d<b>"
<?php
defined('_JEXEC') or die();
class EmeraldRuleCom_weblinks extends EmeraldRule
{
public function getDescription()
{
return JText::sprintf('WL_HINT', $this->params->get('cat_id'));
}
public function isProtected()
{
return true;
}
}
EmeraldRule[rule_name] and extend EmeraldRule$this->params which is instance of JRegistry. Here you can access what user have chosen on plan restriction.Should return string. This is summary of the restriction to show in rule balloon.

Should return true or false. This method is triggered onAfterRoute Joomla event. Here you can check what weblinks or weblink category we are trying to open.
To pack rule we have to create com_weblinks.xml Joomla installation XML file.
<?xml version="1.0" encoding="utf-8"?>
<extension version="3.0" type="file" method="upgrade">
<name>Emerald - Rule - Weblinks</name>
<author>[autor_name]</author>
<license>GPL GNU</license>
<authorEmail>[emil]</authorEmail>
<authorUrl>[url]</authorUrl>
<creationDate>March 2012</creationDate>
<copyright>[you_name]</copyright>
<version>9.0</version>
<description>Emerald rule for Joomla weblinks extension.</description>
<fileset>
<files target="components/com_emerald/library/rules">
<folder>com_weblinks</folder>
</files>
<files folder="com_weblinks" target="language/en-GB">
<filename>en-GB.com_emerald_rule_com_weblinks.ini</filename>
</files>
</fileset>
</extension>
Now when you have XML ready just zip this file along with com_weblinks folder. Here is how it should looks in zip archive.
Zip Root
|- com_weblinks/
| |- com_weblinks.xml
| |- com_weblinks.php
| `- en-GB.com_emerald_rule_com_weblinks.ini
`- com_weblinks.xml