-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
40 additions
and
9 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
18 changes: 18 additions & 0 deletions
18
Lombiq.HelpfulLibraries.OrchardCore/Environment/FeatureInfoEnumerableExtensions.cs
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,18 @@ | ||
using OrchardCore.Environment.Extensions.Features; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
|
||
namespace OrchardCore.Environment.Shell; | ||
|
||
/// <summary> | ||
/// Shortcuts for <see cref="IEnumerable{IFeatureInfo}"/>. | ||
/// </summary> | ||
public static class FeatureInfoEnumerableExtensions | ||
{ | ||
/// <summary> | ||
/// Checks whether the given <see cref="IEnumerable{IFeatureInfo}"/> contains a feature with the given technical ID. | ||
/// </summary> | ||
/// <param name="featureId">Technical ID of the module feature.</param> | ||
public static bool Any(this IEnumerable<IFeatureInfo> featureInfos, string featureId) => | ||
featureInfos.Any(feature => feature.Id == featureId); | ||
} |
16 changes: 16 additions & 0 deletions
16
Lombiq.HelpfulLibraries.OrchardCore/Environment/ShellFeaturesManagerExtensions.cs
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,16 @@ | ||
using System.Threading.Tasks; | ||
|
||
namespace OrchardCore.Environment.Shell; | ||
|
||
/// <summary> | ||
/// Shortcuts for <see cref="IShellFeaturesManager"/>. | ||
/// </summary> | ||
public static class ShellFeaturesManagerExtensions | ||
{ | ||
/// <summary> | ||
/// Checks whether the given module feature is enabled for the current shell. | ||
/// </summary> | ||
/// <param name="featureId">Technical ID of the module feature.</param> | ||
public static async Task<bool> IsFeatureEnabledAsync(this IShellFeaturesManager shellFeaturesManager, string featureId) => | ||
(await shellFeaturesManager.GetEnabledFeaturesAsync()).Any(featureId); | ||
} |
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