public function rename($tagId, $caption) { $tag = new Tag($this->getDataSource()); $tag->loadById((int) $tagId); $tag->setValue('caption', $caption); $tag->setValue('slug', slugify($caption)); $tag->setInheritableAttributesValues(array('attributes' => array('title' => $caption)), true); $tag->update(); return $tag; }
echo "Create Content tag type\n"; $query = "\n INSERT INTO " . Type::getTableName() . " (\n parent_id,\n qname,\n caption,\n datecreation\n ) VALUES (\n " . $rootTypeNode->getId() . ",\n 'content',\n 'Contenu',\n NOW()\n )\n"; $tagDataSource->query($query); $tagTypeContent = new Type($tagDataSource); $tagTypeContent->loadBy('qname', 'content'); $tagTypeContent->setValue('data', '{ "attributes": { "image": { "caption": "Image", "mandatory": false, "type": "image", "default": null, "enable": true } }, "rules": [] }'); $tagTypeContent->update(); $tree = new Type(); $tree->setSource($tagDataSource); $tree->buildTree(); echo "Create root tag \n"; $contentTagType = new Type($tagDataSource); $contentTagType->loadBy('qname', 'default'); $tag = new Tag(); $tag->setSource($tagDataSource); $tag->setValue('type_id', $contentTagType->getId()); $tag->setCaption('Tags'); $tag->insert(); $tagDataSource->commit(); $tag->buildTree();