1. Go to this page and download the library: Download aplia/content-tools library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
aplia / content-tools example snippets
// Define the class, does not modify the database
$type = new Aplia\Content\ContentType('folder', 'Folder', array(
'groups' => array('Content'),
'isContainer' => true,
'contentObjectName' => '<title>',
'alwaysAvailable' => false,
'description' => 'Container for other content objects',
'sortBy' => 'name',
))
->addAttribute('ezstring', 'title', 'Title');
// Create the content-class in the database
$type->create();
// Create an object wrapper which is filled with data
$type = new Aplia\Content\ContentType('folder');
$folder = $type->contentObject(array(
'locations' => array(array('parent_id' => 2)),
))
->setAttribute('title', 'New folder');
// Create the object in the database and publish it
$folder->create(true);
$object->setAttribute('body', new Aplia\Content\HtmlText('<p>My text</p>'));
$object->setAttribute('image', new Aplia\Content\HttpFile('portrait_image'));
class Selection2Handler extends ContentBaseHandler implements ContentInputHandler
{
public function storeContent($value)
{
$this->attribute->setAttribute('data_int', $value);
}
}
iguration = new \Aplia\Migration\Configuration();
return $configuration->setupPhinx();
console
cat <export_name>.ndjson | sed -e '/ez_contentobject/,$d' > <export_name>.head; cat <export_name>.ndjson | sed -n -e '/ez_contentobject/,$p' | split -l5 - <export_name>- --additional-suffix=.tmp --numeric-suffixes=1; for f in <export_name>-*.tmp; do cat <export_name>.head "$f" > "${f%.*}".ndjson; rm "$f"; done
ini
TransformByUuid[c1426628bb809712ac78e8527ef93739]=FrontpageTransformation
ini
TransformByClass[user]=UserTransform
ini
Transform[]=GenericTransform
ini
[DataTypeSettings]
ContentInputHandler[ezselection2]=class;Selection2Handler
ini
[DataTypeSettings]
ContentInputHandler[ezselection2]=string
ini
[Migration]
Path=extension/mysite/migrations
ini
[Migration]
NamespacedPaths[Namespace\Path]=extension/mysite/migrations