MC4WP_Integration_Manager::get PHP Method

get() public method

Get an integration instance
public get ( string $slug ) : MC4WP_Integration
$slug string
return MC4WP_Integration
    public function get($slug)
    {
        if (!isset($this->integrations[$slug])) {
            throw new Exception(sprintf("No integration with slug %s has been registered.", $slug));
        }
        return $this->integrations[$slug]->load();
    }

Usage Example

 /**
  * @param string $slug
  *
  * @internal
  */
 public function show_integration_settings_page($slug)
 {
     try {
         $integration = $this->integrations->get($slug);
     } catch (Exception $e) {
         echo sprintf('<h3>Integration not found.</h3><p>No integration with slug <strong>%s</strong> was found.</p>', $slug);
         return;
     }
     $opts = $integration->options;
     $lists = $this->mailchimp->get_lists();
     require dirname(__FILE__) . '/views/integration-settings.php';
 }