* @param string $objectType object type identifier
* @param integer $objectID object id
*/
- public function process($html, $objectType, $objectID);
+ public function process($html, $objectType, $objectID = 0);
/**
* Returns the parsed html.
/**
* @inheritDoc
*/
- public function process($html, $objectType, $objectID) {
- $this->setContext($objectType, $objectID);
+ public function process($html, $objectType, $objectID = 0) {
+ // object id is always `0` during input processing but is set
+ // before saving embedded objects
+ $this->setContext($objectType, 0);
// enforce consistent newlines
$html = StringUtil::unifyNewlines($html);
return $this->htmlInputNodeProcessor;
}
+ /**
+ * Sets the new object id.
+ *
+ * @param integer $objectID object id
+ */
+ public function setObjectID($objectID) {
+ $this->context['objectID'] = $objectID;
+ }
+
/**
* @return IHtmlInputFilter
*/
/**
* @inheritDoc
*/
- public function process($html, $objectType, $objectID) {
+ public function process($html, $objectType, $objectID = 0) {
+ if ($objectID === 0) {
+ throw new \UnexpectedValueException('Object id cannot be 0 for output processing.');
+ }
+
$this->setContext($objectType, $objectID);
$this->getHtmlOutputNodeProcessor()->setOutputType($this->outputType);