Example #1
0
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();