"MyCustomCatalogApi" class
.../MyCustomCatalogApi.php
<?php
/**
* Class MyCustomCatalogApi
*/
class MyCustomCatalogApi extends \PCT\CustomCatalog\API\Base
{
/**
* Run
* {@inheritdoc}
* (is mandatory by interface)
*/
public function run()
{
print('Executed API: '.$this->id);
// create a backup record
if($this->backup)
{
$this->createBackup();
}
}
}
The public function run()
is mandatory for any API class that extends the \PCT\CustomCatalog\API\Base
class.
It is recommended to extend the
\PCT\CustomCatalog\API\Base
class for any main API class. The base class provides many prebuilt methods to rely on when building your own api.
Reference
class
\PCT\CustomCatalog\API\Base
pct_customelements_plugin_customcatalog/PCT/CustomCatalog/API/Base.php
interface
\PCT\CustomCatalog\Interfaces\ApiInterface
pct_customelements_plugin_customcatalog/PCT/CustomCatalog/Interfaces/ApiInterface.php