Jeremy
in memoriam 1991-2020
OK,
I'm certain this is my last DataWriter question. How on earth do I get the inputed data. Using $this->getExisting('fieldname'); seems to return NULL on an add command. $this->getNew() seemed to not work as expected. I honestly am dumb founded at this. I've looked over the files multiple times, attempted multiple functions... added the table name in them... its just not working for me... Help would be appreciated (and I started with getExisting because I saw it in XenForo somewhere). Here's part of my datawriter:
And the _verifyAMethod() always gets a TRUE value.
I'm certain this is my last DataWriter question. How on earth do I get the inputed data. Using $this->getExisting('fieldname'); seems to return NULL on an add command. $this->getNew() seemed to not work as expected. I honestly am dumb founded at this. I've looked over the files multiple times, attempted multiple functions... added the table name in them... its just not working for me... Help would be appreciated (and I started with getExisting because I saw it in XenForo somewhere). Here's part of my datawriter:
PHP:
<?php
class KingK_BbCodeManager_DataWriter_CustomBbCodes extends XenForo_DataWriter
{
protected $_existingDataErrorPhrase = 'bbcm_bbCodeNotFound';
protected function _getFields()
{
return array(
'kingk_bbcm' => array(
'tag' => array('type' => self::TYPE_STRING, 'required' => true, 'maxLength' => 25,
'verification' => array('$this', '_verifyBbCodeId'),
'requiredError' => 'bbcm_errorInvalidId'
),
'title' => array('type' => self::TYPE_STRING, 'required' => true, 'maxLength' => 50,
'requiredError' => 'please_enter_valid_title'
),
'description' => array('type' => self::TYPE_STRING, 'required' => true, 'maxLength' => 255,
'requiredError' => 'bbcm_pleaseEnterValidDesc'
),
'replacementBegin' => array('type' => self::TYPE_STRING, 'default' => '',
),
'replacementEnd' => array('type' => self::TYPE_STRING, 'default' => '',
),
'phpcallback_class' => array('type' => self::TYPE_STRING, 'default' => '', 'maxLength' => 255,
),
'phpcallback_method' => array('type' => self::TYPE_STRING, 'default' => '', 'maxLength' => 255,
),
'example' => array('type' => self::TYPE_STRING, 'required' => true,
'requiredError' => 'please_enter_embed_html'
),
'active' => array('type' => self::TYPE_UINT, 'default' => 1),
'requiresOption' => array('type' => self::TYPE_UINT, 'default' => 0),
)
);
}
protected function _verifyOnlyOneMethod()
{
if($this->get('replacementBegin') && $this->get('phpcallback_method'))
{
$this->error(new XenForo_Phrase('bbcm_errorEnterOneReplacementMethod'), 'tag');
return false;
}
if($this->get('replacementBegin') && $this->get('phpcallback_class'))
{
$this->error(new XenForo_Phrase('bbcm_errorEnterOneReplacementMethod'), 'tag');
return false;
}
if($this->get('replacementEnd') && $this->get('phpcallback_class'))
{
$this->error(new XenForo_Phrase('bbcm_errorEnterOneReplacementMethod'), 'tag');
return false;
}
if($this->get('replacementEnd') && $this->get('phpcallback_method'))
{
$this->error(new XenForo_Phrase('bbcm_errorEnterOneReplacementMethod'), 'tag');
return false;
}
return true;
}
protected function _verifyAMethod()
{
if($this->get('phpcallback_class') == '' && $this->get('phpcallback_method') == '' && $this->get('replacementBegin') == '' && $this->get('replacementEnd') == '')
{
$this->error(new XenForo_Phrase('bbcm_errorEnterAReplacementMethod'), 'tag');
return false;
}
return true;
}
}
And the _verifyAMethod() always gets a TRUE value.