Skip to content

Commit

Permalink
Add FooterCreds brick
Browse files Browse the repository at this point in the history
  • Loading branch information
GaryJones committed Jun 29, 2017
1 parent 017fd0b commit 68398d8
Show file tree
Hide file tree
Showing 2 changed files with 84 additions and 0 deletions.
83 changes: 83 additions & 0 deletions src/FooterCreds.php
@@ -0,0 +1,83 @@
<?php
/**
* This file contains elements for managing Genesis footer creds text.
*
* @package Gamajo\GenesisThemeTookit
* @author Gary Jones
* @copyright Gamajo
* @license MIT
*/

declare(strict_types=1);

namespace Gamajo\GenesisThemeToolkit;

use BrightNucleus\Config\ConfigInterface;
use BrightNucleus\Config\ConfigTrait;
use BrightNucleus\Config\Exception\FailedToProcessConfigException;

/**
* Sets the footer credits content.
*
* Example config:
*
* ```
* $gamajo_genesis_footer_creds = [
* FooterCreds::CREDS => sprintf(
* // translators: %s: URL for Incipio.
* __( 'Built on <a href="%s" rel="nofollow">Incipio</a> theme for Genesis Framework.', 'your-theme' ),
* esc_url( 'https://gamajo.com/incipio' )
* ),
* ];
* ```
*
* And then:
*
* ```
* return [
* 'Gamajo' => [
* 'Theme' => [
* GenesisThemeToolkit::FOOTERCREDS => $gamajo_genesis_footer_creds,
* ],
* ],
* ];
* ```
*
* @package Gamajo\GenesisThemeToolkit
*/
class FooterCreds
{
const CREDS = 'creds';

use ConfigTrait;

/**
* Initialise FooterCreds object.
*
* @param ConfigInterface $config Config to parametrize the object.
*
* @throws FailedToProcessConfigException If the Config could not be parsed correctly.
*/
public function __construct(ConfigInterface $config)
{
$this->processConfig($config);
}

/**
* Apply filters and hooks.
*/
public function apply()
{
add_filter('genesis_footer_creds_text', [$this, 'credsText']);
}

/**
* Change the footer text.
*
* @return string Footer credentials.
*/
public function credsText(): string
{
return $this->config->getKey('creds');
}
}
1 change: 1 addition & 0 deletions src/GenesisThemeToolkit.php
Expand Up @@ -35,6 +35,7 @@
class GenesisThemeToolkit
{
const BREADCRUMBARGS = 'BreadcrumbArgs';
const FOOTERCREDS = 'FooterCreds';
const LAYOUTS = 'Layouts';
const TEMPLATES = 'Templates';
const THEMESETTINGS = 'ThemeSettings';
Expand Down

0 comments on commit 68398d8

Please sign in to comment.