updates from most recent website build
This commit is contained in:
28
app/ACF/CloneGroup.php
Normal file
28
app/ACF/CloneGroup.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\ACF;
|
||||
|
||||
class CloneGroup
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
|
||||
}
|
||||
public function background()
|
||||
{
|
||||
return [
|
||||
'contrast',
|
||||
'bg_type',
|
||||
'bg_colour',
|
||||
'bg_tint',
|
||||
'bg_opacity',
|
||||
'bg_image',
|
||||
'bg_video',
|
||||
'pattern',
|
||||
'pattern_top',
|
||||
'pattern_bottom',
|
||||
'padding_top',
|
||||
'padding_bottom',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -1,16 +1,58 @@
|
||||
<?php
|
||||
|
||||
namespace App\ACF;
|
||||
use ourcodeworld\NameThatColor\ColorInterpreter as NameThatColor;
|
||||
use App\Utilities;
|
||||
|
||||
class Dynamic
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
add_filter('acf/load_field/name=colour', [ $this, 'load_colours' ]);
|
||||
add_filter('acf/load_field/name=bg_colour', [ $this, 'load_colours' ]);
|
||||
add_filter('acf/load_field/name=tint', [ $this, 'load_tints' ]);
|
||||
add_filter('acf/load_field/name=bg_tint', [ $this, 'load_tints' ]);
|
||||
add_filter('acf/load_field/name=fontawesome_regular', [ $this, 'load_fontawesome_regular_icons' ]);
|
||||
add_filter('acf/load_field/name=fontawesome_solid', [ $this, 'load_fontawesome_solid_icons' ]);
|
||||
add_filter('acf/load_field/name=fontawesome_brands', [ $this, 'load_fontawesome_brand_icons' ]);
|
||||
}
|
||||
|
||||
public function load_colours( $field )
|
||||
{
|
||||
$colour = new Utilities\Colour;
|
||||
$NameThatColour = new NameThatColor;
|
||||
|
||||
$colours = $colour->values();
|
||||
|
||||
$field['choices'] = [];
|
||||
|
||||
foreach($colours as $slug => $hex):
|
||||
$field['choices'][$slug] = '<i class="fas fa-circle" style="color: '. $hex .'"></i> ' . @$NameThatColour->name($hex)['name'];
|
||||
endforeach;
|
||||
|
||||
return $field;
|
||||
|
||||
}
|
||||
|
||||
public function load_tints( $field )
|
||||
{
|
||||
$colour = new Utilities\Colour;
|
||||
$tints = $colour->tints();
|
||||
|
||||
$field['choices'] = [];
|
||||
|
||||
foreach($tints as $slug => $hex):
|
||||
if($slug):
|
||||
$field['choices'][$slug] = ucfirst($slug);
|
||||
|
||||
else:
|
||||
$field['choices'][0] = 'None';
|
||||
endif;
|
||||
endforeach;
|
||||
|
||||
return $field;
|
||||
}
|
||||
|
||||
public function load_fontawesome_regular_icons( $field )
|
||||
{
|
||||
$field['choices'] = [];
|
||||
|
||||
23
app/ACF/Options.php
Normal file
23
app/ACF/Options.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace App\ACF;
|
||||
|
||||
class Options
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
add_filter('acf/init', [$this, 'company']);
|
||||
}
|
||||
|
||||
public function company()
|
||||
{
|
||||
acf_add_options_page([
|
||||
'page_title' => __('Global Settings'),
|
||||
'menu_title' => __('Global Settings'),
|
||||
'menu_slug' => 'theme-global-settings',
|
||||
'capability' => 'edit_others_posts',
|
||||
'redirect' => false,
|
||||
'icon_url' => 'dashicons-admin-site',
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user