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://github.com/flipbox/spark/blob/master/LICENSE
* @link https://github.com/flipbox/spark
*/
namespace flipbox\spark\elements;
use Craft;
use craft\base\Element;
use craft\validators\HandleValidator;
use flipbox\spark\helpers\ElementHelper;
* @author Flipbox Factory <[email protected]>
* @since 1.0.0
abstract class ElementWithHandle extends Element
{
* @var string Handle
public $handle;
* @inheritdoc
public function rules()
return array_merge(
parent::rules(),
[
'handle'
],
HandleValidator::class
'required'
'string',
'max' => 255
'safe',
'on' => [
ElementHelper::SCENARIO_DEFAULT
]
);
}
public function attributeLabels()
parent::attributeLabels(),
'handle' => Craft::t('app', 'Handle')