Skip to content

Commit

Permalink
Added tagline component.
Browse files Browse the repository at this point in the history
  • Loading branch information
colintucker committed Aug 31, 2018
1 parent b815913 commit c421584
Show file tree
Hide file tree
Showing 7 changed files with 167 additions and 3 deletions.
Binary file added admin/client/dist/images/icons/TaglineComponent.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion admin/client/dist/styles/preview.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added admin/client/src/images/icons/TaglineComponent.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions admin/client/src/styles/_variables.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
/* SilverWare Admin Variables
===================================================================================================================== */

$color-darker-bg: #f1f3f6;

$color-text: #66727d;
$color-text-default: #43536d;

$tab-panel-texture-color: #f6f7f8;
2 changes: 1 addition & 1 deletion admin/client/src/styles/bundle.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// Import SilverStripe Admin Styles:

@import "~silverstripe-admin/styles/variables";
@import "~silverstripe-admin/styles/legacy/themes/default";
//@import "~silverstripe-admin/styles/legacy/themes/default";

// Import Local Variables:

Expand Down
2 changes: 1 addition & 1 deletion admin/client/src/styles/preview.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// Import SilverStripe Admin Styles:

@import "~silverstripe-admin/styles/variables";
@import "~silverstripe-admin/styles/legacy/themes/default";
//@import "~silverstripe-admin/styles/legacy/themes/default";

// Import Local Variables:

Expand Down
158 changes: 158 additions & 0 deletions src/Components/TaglineComponent.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
<?php

/**
* This file is part of SilverWare.
*
* PHP version >=5.6.0
*
* For full copyright and license information, please view the
* LICENSE.md file that was distributed with this source code.
*
* @package SilverWare\Components
* @author Colin Tucker <[email protected]>
* @copyright 2018 Praxis Interactive
* @license https://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
* @link https://github.com/praxisnetau/silverware
*/

namespace SilverWare\Components;

/**
* An extension of the base component class for a tagline component.
*
* @package SilverWare\Components
* @author Colin Tucker <[email protected]>
* @copyright 2018 Praxis Interactive
* @license https://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
* @link https://github.com/praxisnetau/silverware
*/
class TaglineComponent extends BaseComponent
{
/**
* Human-readable singular name.
*
* @var string
* @config
*/
private static $singular_name = 'Tagline Component';

/**
* Human-readable plural name.
*
* @var string
* @config
*/
private static $plural_name = 'Tagline Components';

/**
* Description of this object.
*
* @var string
* @config
*/
private static $description = 'A component which shows the tagline of the site';

/**
* Icon file for this object.
*
* @var string
* @config
*/
private static $icon = 'silverware/silverware: admin/client/dist/images/icons/TaglineComponent.png';

/**
* Defines the table name to use for this object.
*
* @var string
* @config
*/
private static $table_name = 'SilverWare_TaglineComponent';

/**
* Defines an ancestor class to hide from the admin interface.
*
* @var string
* @config
*/
private static $hide_ancestor = BaseComponent::class;

/**
* Defines the extension classes to apply to this object.
*
* @var array
* @config
*/
private static $extensions = [
AlignmentStyle::class
];

/**
* Defines the allowed children for this object.
*
* @var array|string
* @config
*/
private static $allowed_children = 'none';

/**
* Defines the default classes to use when rendering this object.
*
* @var array
* @config
*/
private static $default_classes = [
'typography'
];

/**
* Defines the default title level to use.
*
* @var array
* @config
*/
private static $title_level_default = 'h2';

/**
* Answers a list of field objects for the CMS interface.
*
* @return FieldList
*/
public function getCMSFields()
{
// Obtain Field Objects (from parent):

$fields = parent::getCMSFields();

// Remove Field Objects:

$fields->removeFieldFromTab('Root.Options', 'TitleOptions');

// Answer Field Objects:

return $fields;
}

/**
* Overrides the parent method so style extensions can add classes to the component class names.
*
* @return array
*/
public function getClassNames()
{
$classes = parent::getClassNames();

$this->extend('updateContentClassNames', $classes);

return $classes;
}

/**
* Answers the title of the component for the template.
*
* @return string
*/
public function getTitleText()
{
return $this->getSiteConfig()->Tagline;
}
}

0 comments on commit c421584

Please sign in to comment.