
#                                      Copyright 2025 WebPros International, LLC
#                                                           All rights reserved.
# copyright@cpanel.net                                         http://cpanel.net
# This code is subject to the cPanel license. Unauthorized copying is prohibited.

package Cpanel::Template::Plugin::EcosystemFeatures;

use cPstrict;

use base 'Template::Plugin';

=head1 MODULE

C<Cpanel::Template::Plugin::EcosystemFeatures>

=head1 DESCRIPTION

C<Cpanel::Template::Plugin::EcosystemFeatures> is a class that provides some common helper methods to
Template Toolkit for cPhlex plugins.

=head1 SYNOPSIS

    [% use EcosystemFeatures %]

    [% EcosystemFeatures.is_plugin_added_to_features %]

=cut

=head1 FUNCTIONS

=cut

=head2 is_plugin_added_to_features

This method will check if the install_plugin script has executed successfully
for a specific plugin.

Returns:
    1 - if the feature is successfully installed
    0 - if the feature is not installed

=cut

sub is_plugin_added_to_features ( $self, $feature_name ) {

    require Cpanel::Plugin::Install;
    my $feature_file = Cpanel::Plugin::Install::_addon_feature_directory() . '/' . $feature_name;
    return -e $feature_file ? 1 : 0;
}

1;
