| 1 |
<?php |
| 2 |
|
| 3 |
namespace WPGraphQL\Type\ObjectType; |
| 4 |
|
| 5 |
use WPGraphQL\Model\UserRole as UserRoleModel; |
| 6 |
|
| 7 |
class UserRole { |
| 8 |
|
| 9 |
/** |
| 10 |
* Register the UserRole Type |
| 11 |
* |
| 12 |
* @return void |
| 13 |
*/ |
| 14 |
public static function register_type() { |
| 15 |
register_graphql_object_type( |
| 16 |
'UserRole', |
| 17 |
[ |
| 18 |
'description' => static function () { |
| 19 |
return __( 'A user role object', 'wp-graphql' ); |
| 20 |
}, |
| 21 |
'model' => UserRoleModel::class, |
| 22 |
'interfaces' => [ 'Node' ], |
| 23 |
'fields' => static function () { |
| 24 |
return [ |
| 25 |
'id' => [ |
| 26 |
'description' => static function () { |
| 27 |
return __( 'The globally unique identifier for the user role object.', 'wp-graphql' ); |
| 28 |
}, |
| 29 |
], |
| 30 |
'name' => [ |
| 31 |
'type' => 'String', |
| 32 |
'description' => static function () { |
| 33 |
return __( 'The registered name of the role', 'wp-graphql' ); |
| 34 |
}, |
| 35 |
], |
| 36 |
'capabilities' => [ |
| 37 |
'type' => [ |
| 38 |
'list_of' => 'String', |
| 39 |
], |
| 40 |
'description' => static function () { |
| 41 |
return __( 'The capabilities that belong to this role', 'wp-graphql' ); |
| 42 |
}, |
| 43 |
], |
| 44 |
'displayName' => [ |
| 45 |
'type' => 'String', |
| 46 |
'description' => static function () { |
| 47 |
return __( 'The display name of the role', 'wp-graphql' ); |
| 48 |
}, |
| 49 |
], |
| 50 |
'isRestricted' => [ |
| 51 |
'type' => 'Boolean', |
| 52 |
'description' => static function () { |
| 53 |
return __( 'Whether the object is restricted from the current viewer', 'wp-graphql' ); |
| 54 |
}, |
| 55 |
], |
| 56 |
]; |
| 57 |
}, |
| 58 |
] |
| 59 |
); |
| 60 |
} |
| 61 |
} |
| 62 |
|