-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #32 from craftcms/feature/subscriptions-field
Add a subscriptions field
- Loading branch information
Showing
3 changed files
with
58 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<?php | ||
/** | ||
* @link https://craftcms.com/ | ||
* @copyright Copyright (c) Pixel & Tonic, Inc. | ||
* @license https://craftcms.github.io/license/ | ||
*/ | ||
|
||
namespace craft\stripe\fields; | ||
|
||
use Craft; | ||
use craft\fields\BaseRelationField; | ||
use craft\stripe\elements\Subscription; | ||
|
||
/** | ||
* Class Stripe Subscriptions Field | ||
* | ||
* @author Pixel & Tonic, Inc. <[email protected]> | ||
* | ||
* @property-read array $contentGqlType | ||
*/ | ||
class Subscriptions extends BaseRelationField | ||
{ | ||
/** | ||
* @inheritdoc | ||
*/ | ||
public static function displayName(): string | ||
{ | ||
return Craft::t('stripe', 'Stripe Subscriptions'); | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
public static function icon(): string | ||
{ | ||
return 'clock-rotate-left'; | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
public static function defaultSelectionLabel(): string | ||
{ | ||
return Craft::t('stripe', 'Add a subscription'); | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
public static function elementType(): string | ||
{ | ||
return Subscription::class; | ||
} | ||
} |