Kernel::System::FrontendConfig::AgentLayout

NAME

Kernel::System::FrontendConfig::AgentLayout

DESCRIPTION

This is the helper module for the agent layout frontend config functionality.

PUBLIC INTERFACE

has UserType

Attribute that holds the type of the user to handle.

MethodParamValidationSchema()

Add the default param validation for the agent layout functions.

DefaultStyles()

Holds the default styles with the different configurations.

    my %DefaultStyles = $AgentLayoutObject->DefaultStyles(
        Style => 'Bright', # optional
    );

Returns

    %DefaultStyles = (
        Bright => {
            Label             => Translatable('Bright'),
            Description       => Translatable('Bright style with lighter background'),
            Active            => 1,
            DefaultLoginLogo  => '',
            DefaultHeaderLogo => '',
            DefaultFavicon    => '',
            Variants          => [
                {
                    Name   => 'Variant1',
                    Label  => Translatable('Variant 1'),
                    Active => 1,
                    Colors => {
                        Primary   => '#304F5A',
                        Secondary => '#6BB7BE',
                        Prominent => '#304F5A',
                    },
                },
                ...
            },
        },
        Dark => {
            ...
        },
        ...
    );

    or (when a style is given)

    $DefaultStyle = (
        Label             => Translatable('Bright'),
        Description       => Translatable('Bright style with lighter background'),
        Active            => 1,
        DefaultLoginLogo  => '',
        DefaultHeaderLogo => '',
        DefaultFavicon    => '',
        Variants          => [
            {
                Name   => 'Variant1',
                Label  => Translatable('Variant 1'),
                Active => 1,
                Colors => {
                    Primary   => '#304F5A',
                    Secondary => '#6BB7BE',
                    Prominent => '#304F5A',
                },
            },
        },
    );

StyleGet()

Get the style list with the data.

    my %StyleData = $AgentLayoutObject->StyleGet(
        Name                 => 'Bright',
        OnlyDefaultValues    => 1,        # optional
        OnlyActive           => 1,        # optional
        OnlyVariantOverwrite => 1,        # optional (not together with OnlyDefaultValues)
    );

Returns

    %StyleData = (
        Label             => Translatable('Bright'),
        Description       => Translatable('Bright style with lighter background'),
        Active            => 1,
        DefaultLoginLogo  => '', # optional
        DefaultHeaderLogo => '', # optional
        DefaultFavicon    => '', # optional
        Variants          => [
            {
                Name   => 'Variant 1',
                Colors => {
                    Primary   => '#304F5A',
                    Secondary => '#6BB7BE',
                    Prominent => '#304F5A',
                },
            },
        },
    );

DefaultStyleGet()

Get the default style and variant.

    my $DefaultStyle = $AgentLayoutObject->DefaultStyleGet(
        Data => {
            Style   => 'Bright',
            Variant => 'Variant1',
        },
        UserID => 1,
    );

Returns

    $DefaultStyle = {
        Style   => 'Bright',
        Variant => 'Variant1',
    };

DefaultStyleSet()

Save the default style and variant.

    my $Success = $AgentLayoutObject->DefaultStyleSet(
        Data => {
            Style   => 'Bright',
            Variant => 'Variant1',
        },
        UserID => 1,
    );

StylesAndVariants()

Returns the style and variant select list.

    my $StylesAndVariants = $AgentLayoutObject->StylesAndVariants(
        Style   => 'Bright',   # optional
        Variant => 'Variant1', # optional
    );

Returns

    $StylesAndVariants = [
        {
            Key     => 'Bright::Variant1',
            Value   => 'Bright::Variant 1',
            Selected => 1,
        },
        {
            Key     => 'Bright::Variant2',
            Value   => 'Bright::Variant 2',
        },
    ];

StyleList()

Get the style list with the data.

    my @StyleList = $AgentLayoutObject->StyleList(
        OnlyDefaultValues    => 1, # optional
        OnlyActive           => 1, # optional
        OnlyVariantOverwrite => 1, # optional (not together with OnlyDefaultValues)
    );

Returns

    @StyleList = (
        {
            ...
        },
    );

LoginLogoGetFilename()

Get the style list with the data.

    my $LoginLogoFilename = $AgentLayoutObject->LoginLogoGetFilename();

Returns

    $LoginLogoFilename = '...';

LoginLogoSet()

Save the values for the give styles.

    my $Success = $AgentLayoutObject->LoginLogoSet(
        Data => {
            # e.g. Changed image for the login logo.
            Filename => '...',
            Content  => '...',
        },
        UserID => 1,
    );

StyleSet()

Save the values for the give styles.

    my $Success = $AgentLayoutObject->StyleSet(
        Name => 'Bright',
        Data => {
            Active     => 1,
            DefaultHeaderLogo => {
                # e.g. Already existing changed image.
                Filename => '...',
            },
            DefaultFavicon    => {
                # e.g. Image deleted or not changed.
            },
            Variants => [
                {
                    Label  => 'Variant 1',
                    Active => 1,
                    Colors => {
                        Primary   => '#000',
                        Secondary => '#111',
                        Prominent => '#222',
                    },
                },
            ],
        },
        UserID => 1,
    );

UpdateStyleOverrides()

Build the style overrides for the current values.

    my $Updated = $AgentLayoutObject->UpdateStyleOverrides(
        UserID => 1,
    );

Returns true if the style overrides was updated.

PRIVATE INTERFACE

_BuildFrontendConfigObject()

The /_BuildFrontendConfigObject() method will create an instance of the Kernel::System::FrontendConfig object.

_SetImage()

Set the image in the virtual file system.

_DeleteImage()

Delete the image in the virtual file system.

Scroll to Top