function componentSave($postId, $componentId, $request) { $data = $this->getData($postId); $dataComponent = $this->getComponent($componentId, $data); if ($dataComponent === false) { return false; } $id = $dataComponent['component']['data']['componentId']; $value = array(); foreach ($this->componentData[$id]['structure']['element'] as $elementData) { $name = $elementData['id']; if (!array_key_exists($name, $request)) { continue; } if (in_array($elementData['ui']['element']['type'], array('select-one', 'radio', 'checkbox', 'choice-1', 'choice-2'))) { if ($request[$name] == -1) { $request[$name] = null; } } if (is_array($request[$name])) { $value[$name] = $request[$name]; } else { $value[$name] = $request[$name]; } } PBHelper::formatNewLine($value); $lineIndex = $dataComponent['line']['index']; $columnIndex = $dataComponent['column']['index']; $componentIndex = $dataComponent['component']['index']; $data['line'][$lineIndex]['column'][$columnIndex]['component'][$componentIndex]['value'] = $value; $this->updateData($postId, $data); return true; }