Source of file ShopifyPage.php
Size: 1,541 Bytes - Last Modified: 2021-12-23T10:48:10+00:00
/var/www/docs.ssmods.com/process/src/src/model/ShopifyPage.php
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 | <?php namespace Swordfox\Shopify\Model; use SilverStripe\Forms\DropdownField; use SilverStripe\Forms\NumericField; use SilverStripe\ORM\DataObject; /** * Class ShopifyPage * * @author Graham McLellan * @package Swordfox\Shopify\Model * * @property int PageLimit */ class ShopifyPage extends \Page { private static $table_name = 'ShopifyPage'; private static $children_classes = [ Collection::class => 'Collections', Product::class => 'Products' ]; private static $db = [ 'PageLimit' => 'Int' ]; private static $defaults = [ 'PageLimit' => 9 ]; public function Collections() { return Collection::get(); } public function getCMSFields() { $fields = parent::getCMSFields(); return $fields; } public function getSettingsFields() { $fields = parent::getSettingsFields(); $fields->addFieldsToTab('Root.Settings', [ NumericField::create('PageLimit') ]); return $fields; } /** * Return instance of self * * @return null|DataObject|ShopifyPage */ public static function inst() { return DataObject::get_one(self::class); } /** * Can only create one of self * * @param null $member * @param array $context * @return bool */ public function canCreate($member = null, $context = array()) { return !self::inst() && parent::canCreate($member = null, $context = array()); } } |