Permalink
Cannot retrieve contributors at this time
Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign up
Fetching contributors…

<?php | |
/** | |
* @link https://craftcms.com/ | |
* @copyright Copyright (c) Pixel & Tonic, Inc. | |
* @license https://craftcms.github.io/license/ | |
*/ | |
namespace craft\models; | |
use Craft; | |
use craft\base\Model; | |
/** | |
* Class Structure model. | |
* | |
* @property bool $isSortable whether elements in this structure can be sorted by the current user | |
* @author Pixel & Tonic, Inc. <support@pixelandtonic.com> | |
* @since 3.0.0 | |
*/ | |
class Structure extends Model | |
{ | |
// Properties | |
// ========================================================================= | |
/** | |
* @var int|null ID | |
*/ | |
public $id; | |
/** | |
* @var int|null Max levels | |
*/ | |
public $maxLevels; | |
/** | |
* @var string|null UID | |
*/ | |
public $uid; | |
// Public Methods | |
// ========================================================================= | |
/** | |
* @inheritdoc | |
*/ | |
public function rules() | |
{ | |
$rules = parent::rules(); | |
$rules[] = [['id', 'maxLevels'], 'number', 'integerOnly' => true]; | |
return $rules; | |
} | |
/** | |
* Returns whether elements in this structure can be sorted by the current user. | |
* | |
* @return bool | |
*/ | |
public function getIsSortable(): bool | |
{ | |
return Craft::$app->getSession()->checkAuthorization('editStructure:' . $this->id); | |
} | |
} |