Completed
Push — Component-MapsGoogle ( b0f8c9 )
by
unknown
02:31
created

functions.php ➔ init()   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 11
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 3
eloc 6
nc 2
nop 1
dl 0
loc 11
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace Flynt\Features\GoogleMapsApi;
4
5
use Flynt\Utils\Feature;
6
use Flynt\Features\Acf\OptionPages;
7
8
add_action('acf/fields/google_map/api', 'Flynt\Features\GoogleMapsApi\init', 100);
9
10
function init($api)
11
{
12
    $globalOptions = OptionPages::get('globalOptions', 'feature', 'GoogleMapsApi');
13
    if (!isset($globalOptions['apiKey']) || strlen($globalOptions['apiKey']) === 0) {
14
        return $api;
15
    }
16
17
    $api['key'] = $globalOptions['apiKey'];
18
19
    return $api;
20
}
21