/** * Overrides xPDOObject::set to strip invalid characters from element names. * * {@inheritDoc} */ public function set($k, $v= null, $vType= '') { $set = false; switch ($k) { case 'category': $v = str_replace($this->_invalidCharacters,'',$v); default: $oldParentId = $this->get('parent'); $set = parent::set($k,$v,$vType); if ($set && $k == 'parent' && $v != $oldParentId && !$this->isNew()) { $this->_parentChanged = true; } } return $set; }
/** * Set a field value by the field key or name. * * {@inheritdoc} * * Additional logic added for the following fields: * -alias: Applies {@link modResource::cleanAlias()} * -contentType: Calls {@link modResource::addOne()} to sync contentType * -content_type: Sets the contentType field appropriately */ public function set($k, $v= null, $vType= '') { $rt= false; switch ($k) { case 'alias' : $v= $this->cleanAlias($v); break; case 'contentType' : if ($v !== $this->get('contentType')) { if ($contentType= $this->xpdo->getObject('modContentType', array ('mime_type' => $v))) { if ($contentType->get('mime_type') != $this->get('contentType')) { $this->addOne($contentType, 'ContentType'); } } } break; case 'content_type' : if ($v !== $this->get('content_type')) { if ($contentType= $this->xpdo->getObject('modContentType', $v)) { if ($contentType->get('mime_type') != $this->get('contentType')) { $this->_fields['contentType']= $contentType->get('mime_type'); $this->_dirty['contentType']= 'contentType'; } } } break; } return parent :: set($k, $v, $vType); }
/** * Overrides xPDOObject::set to strip invalid characters from element names. * * {@inheritDoc} */ public function set($k, $v = null, $vType = '') { /* TODO: make into validation, so that this doesnt break tag processing switch ($k) { case 'name': case 'templatename': $v = str_replace($this->_invalidCharacters,'',$v); break; default: break; } */ return parent::set($k, $v, $vType); }
/** * Overridden to handle changes to the static_file source. * * {@inheritdoc} */ public function set($k, $v = null, $vType = '') { $set = parent::set($k, $v, $vType); if ($k === 'static_file' && $set && $this->isStatic()) { $this->setContent($this->getFileContent()); } return $set; }