for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* @copyright Copyright (c) Flipbox Digital Limited
* @license https://flipboxfactory.com/software/hubspot/license
* @link https://www.flipboxfactory.com/software/hubspot/
*/
namespace flipbox\craft\hubspot\cp\actions;
use Craft;
use flipbox\craft\ember\actions\models\CreateModel;
use flipbox\craft\hubspot\HubSpot;
use flipbox\craft\hubspot\models\Settings;
use yii\base\Model;
* @author Flipbox Factory <[email protected]>
* @since 1.0.0
class SaveSettings extends CreateModel
{
* @return array
public $validBodyParams = [
'defaultConnection',
'defaultCache'
];
* @inheritdoc
public $statusCodeSuccess = 200;
* @throws \yii\web\UnauthorizedHttpException
public function run()
return $this->runInternal(
HubSpot::getInstance()->getSettings()
);
}
* @param Settings $model
protected function performAction(Model $model): bool
return Craft::$app->getPlugins()->savePluginSettings(
HubSpot::getInstance(),
$model->toArray(
$this->validBodyParams()
)
* @return Settings
protected function newModel(array $config = []): Model
return clone HubSpot::getInstance()->getSettings();