Syntro\SilverStripeElementalBaseitems\Extensions\BootstrapBaseElementExtension
This Extension abstracts the DNADesign baseelement to apply several additional options useful for bootstrap sections
- Author: Matthias Leutenegger <hello@syntro.ch>
Synopsis
class BootstrapBaseElementExtension
extends DataExtension
{
- // members
- private static string $block_name = 'section';
- private static bool $inline_editable = false;
- private static string $icon = 'font-icon-block-layout';
- private static string $description = 'Bootstrap Section Base element class';
- private static boolean $add_default_background_color = true;
- private static string|null $default_background_color = NULL;
- private static array $background_colors = ;
- private static bool $allow_image_background = true;
- private static string|null $default_text_color = NULL;
- private static array $text_colors = ;
- private static array $text_colors_by_background = ;
- private static array $link_colors_by_text = ;
- private static array $link_colors_by_background = ;
- private static array $db = ;
- private static array $defaults = ;
- private static array $has_one = ;
- private static array $owns = ;
- private static string $singular_name = 'bootstrap section';
- private static string $plural_name = 'bootstrap sections';
- private static string $table_name = 'BootstrapSectionElement';
- // methods
- public FieldList updateCMSFields()
- public array getBackgroundOptions()
- public array getTranslatedOptionsFor()
- public DropdownField|TextField createColorSelectField()
- public string|null getBackgroundColor()
- public string|null getTextColor()
- public string getBackgroundColorClass()
- public string getTextColorClass()
- public string getLinkColor()
- public Image|null getBackgroundImage()
- public string getElementName()
Hierarchy
Extends
- SilverStripe\ORM\DataExtension
Members
private
- $add_default_background_color
—
boolean
if true, the background displays a default label. - $allow_image_background
—
Syntro\SilverStripeElementalBaseitems\Extensions\bool
set to false if image option should not show up - $background_colors
—
array
Available background colors for this Element - $block_name
—
string
This defines the block name in the CSS - $db — array
- $default_background_color
—
Syntro\SilverStripeElementalBaseitems\Extensions\string|null
The default background color. If set, there will always be a class rendered - $default_text_color
—
Syntro\SilverStripeElementalBaseitems\Extensions\string|null
The default text color. If set, there will always be a class rendered - $defaults — array
- $description
—
string
Describe the purpose of this element - $has_one — array
- $icon
—
string
Override this on your custom elements to specify a CSS icon class - $inline_editable
—
Syntro\SilverStripeElementalBaseitems\Extensions\bool
Set to false to prevent an in-line edit form from showing in an elemental area. Instead the element will be clickable and a GridFieldDetailForm will be used. - $link_colors_by_background
—
array
Color mapping from background to link color. This option can be used for special cases where the same text color should have different link colors (i.e. two dark background colors) - $link_colors_by_text
—
array
Color mapping from text color to link color. This array can be used to specify colors of buttons or links depending on the chosen background color. if no value is specified, this will fall back to the text color - $owns — array
- $plural_name
- $singular_name
- $table_name
- $text_colors
—
array
Available text colors for this Element. They are not used unless an image is applied as a section Background, where it becomes important to let the user choose the text color (as it depends on the Image). - $text_colors_by_background
—
array
Color mapping from background color. This is mainly intended to set a default color on the section-level, ensuring text is readable.
Methods
public
- createColorSelectField() — createColorSelectField - generates a field to be displayed in the cms allowing the selection of values from a color list
- getBackgroundColor() — getBackgroundColor - retrun the background color label for this section
- getBackgroundColorClass() — getBackgroundColorClass - retrun the background color class for this section
- getBackgroundImage() — getBackgroundImage - check if this section has a background image and return it
- getBackgroundOptions() — getBackgroundOptions - return possible options for background
- getElementName() — getElementName - retrieve the block-name
- getLinkColor() — getTextColor - retrieve the link color class. Uses $link_colors_by_text and $link_colors_by_background.
- getTextColor() — getTextColor - return the text color label for this section
- getTextColorClass() — getTextColorClass - retrun the text color class for this section
- getTranslatedOptionsFor() — getTranslatedOptionsFor - retrieve a config value prepped for a dropdown
- updateCMSFields() — getCMSFields