2 users online. Create an account or sign in to join them.Users

Search

I'm sure I'm doing something stupidly wrong but I'm not able to store multiple field values in an extension I'm working on.

As far as I know, processRawFieldData() is taking care of the data processing. The passed data array looks like this:

Array
(
    [relation_id] => Array
        (
            [0] => 2003
            [1] => 
        )

    [tab] => Array
        (
            [0] => Deutsch
            [1] => Englisch
        )

)

Which should be stored as two separate entries in a table that looks like this:

`id` int(11) unsigned NOT NULL auto_increment,
`entry_id` int(11) unsigned NOT NULL,
`relation_id` int(11) unsigned DEFAULT NULL,
`tab` varchar(255) NOT NULL

This is how my function looks like:

function processRawFieldData($data, &$status, $simulate=false, $entry_id=NULL) {
    $status = self::__OK__;
    if(empty($data)) return NULL;

    return $data;
}

Nothing gets stored and there are no errors.
What am I doing wrong?

Should the array become? Not sure.

[0] => 'relation_id' => 2003, 'tab' => 'English'
[1] => 'relation_id' => NULL, 'tab' => 'Deutsch'

Best place to debug would be in Field::setDataFromPost which is where processRawFieldData is called from. Are there any existing extensions that do the same thing, that you can look through?

The select field does it like this:

    public function processRawFieldData($data, &$status, $simulate=false, $entry_id=NULL){
        $status = self::__OK__;

        if(!is_array($data)) return array('value' => $data, 'handle' => Lang::createHandle($data));

        if(empty($data)) return NULL;

        $result = array('value' => array(), 'handle' => array());

        foreach($data as $value){
            $result['value'][] = $value;
            $result['handle'][] = Lang::createHandle($value);
        }

        return $result;
    }

Okay, forget about this. There was a typo in displayPublishPanel() which caused a general saving failure. Still it's strange that the error wasn't shown anywhere.

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.2 or above
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.0 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details