public function missing_settings()
 {
     $ns = Helper::get('agreable_namespace');
     $screen = get_current_screen();
     $app_id = get_field("{$ns}_plugin_firebase_api_key", 'options');
     if (empty($app_id)) {
         $options = get_admin_url(null, '/admin.php?page=acf-options#acf-options_group_agreable_venues');
         $missing = empty($app_id) ? "'Firebase API Key'" : '';
         Notifier::error("Your are missing options that will cause Venues to not display correctly ({$missing}). Please visit <a href='{$options}'>Options</a> page and contact the digital operations team if necessary.");
         return;
     }
 }
 public function addPaths($paths)
 {
     // Get views specified in herbert.
     $namespaces = Helper::get('views');
     foreach ($namespaces as $namespace => $views) {
         foreach ((array) $views as $view) {
             // Add to timber $paths array.
             array_unshift($paths, $view);
         }
     }
     return $paths;
 }
 public function render($venue = null)
 {
     $css_string = @file_get_contents(Helper::path('/resources/assets/styles.css'));
     $js_string = @file_get_contents(Helper::path('/resources/assets/app.js'));
     $webpack_port = null;
     $environment = getenv('WP_ENV');
     if ($environment === 'development') {
         try {
             $webpack_port = $this->get_webpack_port(Helper::path(''));
         } catch (\Exception $e) {
             // If exception the developer hasn't run webpack so may not be
             // 'developing' this particular plugin, force 'production'
             $environment = 'production';
         }
     }
     $views = trailingslashit(Helper::get('views')['template']);
     $context = \Timber::get_context();
     $context['body_class'] = $context['body_class'] . ' agreable-venues-plugin';
     $context['env'] = $environment;
     // $context['common_css_path'] = Helper::asset('styles.css');
     $context['js_string'] = $js_string;
     $context['css_string'] = $css_string;
     $context['css_path'] = '/resources/assets/styles.css';
     $context['js_path'] = '/resources/assets/app.js';
     $context['webpack_plugin_port'] = $webpack_port;
     $brand_str = strtolower(get_field('venues_brand', 'option'));
     $brands = !empty($brand_str) ? array_map('trim', explode(',', $brand_str)) : array();
     $context['initial_state'] = array('app' => array('site' => array('sitename' => get_bloginfo('name'), 'env' => $environment, 'terms' => get_field('venues_promo_terms', 'option')), 'firebase' => array('api_key' => get_field('venues_firebase_api_key', 'option'), 'auth_domain' => get_field('venues_firebase_auth_domain', 'option'), 'db_url' => get_field('venues_firebase_db_url', 'option'), 'storage_bucket' => get_field('venues_firebase_storage_bucket', 'option'), 'brands' => $brands), 'map' => array('mapboxToken' => get_field('venues_map_mapbox_token', 'option'), 'mapboxMapId' => get_field('venues_map_mapbox_mapid', 'option'), 'slug' => get_field('agreable_venues_plugin_map_slug', 'option'), 'tileUrl' => get_field('venues_map_tiles_url', 'option'), 'locationDetails' => get_field('map_initial_locations', 'option')), 'display_vouchers' => get_field('field_578dff0210320', 'option')));
     $context['calais_domain'] = 'https://calaisapi.com';
     if (isset($venue)) {
         // If on single venue page we set all meta data accordingly.
         $context['wp_title'] = htmlentities($venue->get('name'));
         $context['post'] = $this->get_post_meta_data($venue);
     }
     \Timber::render("{$views}template.twig", $context);
 }
<?php

namespace AgreableVenuesPlugin;

use AgreableVenuesPlugin\Helper;
$ns = Helper::get('agreable_namespace');
if (function_exists('register_field_group')) {
    register_field_group(array('key' => "options_group_{$ns}", 'title' => 'Venues Settings', 'fields' => array(array('key' => "{$ns}_plugin_map_slug", 'label' => 'Venues Map URL prefix', 'name' => 'venues_map_slug', 'type' => 'text', 'required' => 0, 'conditional_logic' => 0, 'default_value' => 'map', 'readonly' => 0, 'disabled' => 0), array('key' => "{$ns}_plugin_brand", 'label' => 'Brand - Choose which brand to filter Venues by', 'name' => 'venues_brand', 'type' => 'text', 'instructions' => 'E.g. mr-hyde, emerald-street, shortlist, stylist. All lowercase and no spaces/hyphenated. Multiple brands accepted using comma delimination. Leave blank to show all.', 'required' => 0, 'conditional_logic' => 0, 'readonly' => 0, 'disabled' => 0), array('key' => "{$ns}_plugin_firebase_api_key", 'label' => 'Firebase API Key', 'name' => 'venues_firebase_api_key', 'type' => 'text', 'required' => 1, 'conditional_logic' => 0, 'readonly' => 0, 'disabled' => 0), array('key' => "{$ns}_plugin_firebase_auth_domain", 'label' => 'Firebase Auth Domain', 'name' => 'venues_firebase_auth_domain', 'type' => 'text', 'required' => 1, 'conditional_logic' => 0, 'readonly' => 0, 'disabled' => 0), array('key' => "{$ns}_plugin_firebase_db_url", 'label' => 'Firebase Database URL', 'name' => 'venues_firebase_db_url', 'type' => 'text', 'required' => 1, 'conditional_logic' => 0, 'readonly' => 0, 'disabled' => 0), array('key' => "{$ns}_plugin_firebase_storage_bucket", 'label' => 'Firebase Storage Bucket', 'name' => 'venues_firebase_storage_bucket', 'type' => 'text', 'instructions' => 'This isn\'t used at the moment', 'required' => 0, 'conditional_logic' => 0, 'readonly' => 0, 'disabled' => 0), array('key' => "{$ns}_plugin_map_tiles_url", 'label' => 'Map Tiles URL', 'name' => 'venues_map_tiles_url', 'type' => 'text', 'required' => 1, 'conditional_logic' => 0, 'default_value' => 'https://{s}.tiles.mapbox.com/v4/{mapId}/{z}/{x}/{y}.png?access_token={token}', 'readonly' => 0, 'disabled' => 0), array('key' => "{$ns}_plugin_map_mapbox_token", 'label' => 'Mapbox Access Token', 'name' => 'venues_map_mapbox_token', 'type' => 'text', 'required' => 0, 'conditional_logic' => 0, 'readonly' => 0, 'disabled' => 0), array('key' => "{$ns}_plugin_map_mapbox_mapid", 'label' => 'Mapbox Map ID', 'name' => 'venues_map_mapbox_mapid', 'type' => 'text', 'required' => 0, 'conditional_logic' => 0, 'readonly' => 0, 'disabled' => 0), array('key' => "{$ns}_initial_locations", 'label' => 'Map Initial Locations', 'name' => 'map_initial_locations', 'type' => 'repeater', 'required' => 0, 'conditional_logic' => 0, 'layout' => 'table', 'button_label' => 'Add Row', 'sub_fields' => array(array('key' => "{$ns}_location_name", 'label' => 'Location Name', 'name' => 'location_name', 'type' => 'text', 'required' => 0, 'conditional_logic' => 0), array('key' => "{$ns}_location_latitude", 'label' => 'Location Latitude', 'name' => 'location_latitude', 'type' => 'text', 'required' => 0, 'conditional_logic' => 0), array('key' => "{$ns}_location_longitude", 'label' => 'Location Longitude', 'name' => 'location_longitude', 'type' => 'text', 'required' => 0, 'conditional_logic' => 0))), array('key' => "{$ns}_plugin_terms", 'label' => 'Venues Promotion Terms and Conditions', 'name' => 'venues_promo_terms', 'type' => 'wysiwyg', 'required' => 0, 'conditional_logic' => 0, 'readonly' => 0, 'disabled' => 0)), 'location' => array(array(array('param' => 'options_page', 'operator' => '==', 'value' => 'acf-options'), array('param' => 'current_user_role', 'operator' => '==', 'value' => 'administrator'))), 'menu_order' => 1, 'position' => 'normal', 'style' => 'default', 'label_placement' => 'top', 'instruction_placement' => 'label'));
}