Skip to content

Instantly share code, notes, and snippets.

@drmmr763
Created September 3, 2012 13:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save drmmr763/3609328 to your computer and use it in GitHub Desktop.
Save drmmr763/3609328 to your computer and use it in GitHub Desktop.
SobiPro element plugin for Fabrik
<?php
/**
* @package Joomla.Plugin
* @subpackage Fabrik.element.checkbox
* @copyright Copyright (C) 2005 Fabrik. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die();
/**
* Plugin element to render series of checkboxes
*
* @package Joomla.Plugin
* @subpackage Fabrik.element.checkbox
* @since 3.0
*/
class plgFabrik_ElementSobipro extends plgFabrik_Element
{
/**
* Does the element have a label
* @var bool
*/
protected $hasLabel = false;
protected $inputType = 'sobipro';
/**
* Set the element id
* and maps parameter names for common ElementList options
*
* @param int $id element id
*
* @return void
*/
public function setId($id)
{
parent::setId($id);
$params = $this->getParams();
// Set elementlist params from checkbox params
$params->set('options_per_row', $params->get('ck_options_per_row'));
$params->set('allow_frontend_addto', (bool) $params->get('allow_frontend_addtocheckbox', false));
$params->set('allowadd-onlylabel', (bool) $params->get('chk-allowadd-onlylabel', true));
$params->set('savenewadditions', (bool) $params->get('chk-savenewadditions', false));
}
function render($data, $repeatCounter = 0)
{
$name = $this->getHTMLName($repeatCounter);
$id = $this->getHTMLId($repeatCounter);
$element = $this->getElement();
$params = $this->getParams();
$value = $this->getValue($data, $repeatCounter);
$bits['value'] = 'x';
$data = "x";
return $this->buildInput('input', $bits);
}
protected function buildInput($node = 'input', $bits = array()) {
$str = '
<input type="checkbox" name="vehicle" value="bike" />box 1<br />
<input type="checkbox" name="vehicle" value="car" />box 2
';
return $str;
}
public function recordInDatabase($data = "x")
{
return $this->_recordInDatabase;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment