_path = $this->_slug . '/php/class-adapter-add-on.php'; $this->_title = __( 'Adapter Gravity Add On', 'adapter-gravity-add-on' ); $this->_short_title = __( 'Adapter Add On', 'adapter-gravity-add-on' ); } /** * Call the parent init method, and add the plugin actions. * * @return void */ public function init() { parent::init(); $this->load_add_on_files(); $this->instantiate_classes(); add_action( 'init', array( $this, 'textdomain' ) ); } /** * Load the textdomain for the add-on, enabling translation. * * @action init * @return void */ public function textdomain() { load_plugin_textdomain( $this->_slug ); } /** * Load the add-on files. * * @return void */ public function load_add_on_files() { require_once __DIR__ . '/class-email-setting.php'; require_once __DIR__ . '/class-email-form.php'; require_once __DIR__ . '/class-layout-setting.php'; } /** * Instantiate the add-on classes. * * @return void */ public function instantiate_classes() { $this->components['email_setting'] = new Email_Setting( $this ); $this->components['email_form'] = new Email_Form( $this ); $this->components['email_setting']->init(); $this->components['email_form']->init(); } /** * Get the stylesheet to enqueue. * * Follows the convention for add-ons in the Gravity Forms documentation. * Uses this class's method do_enqueue() as a callback. * * @return array $styles The stylesheets to enqueue.. */ public function styles() { $styles = array( array( 'handle' => $this->_slug . '-gravity-style', 'src' => plugins_url( $this->_slug . '/css/aga-gravity.css' ), 'version' => $this->_version, 'enqueue' => array( array( $this, 'do_enqueue' ), ), ), ); return array_merge( parent::styles(), $styles ); } /** * Whether to enqueue this add-on's styling. * * @return boolean $do_enqueue Whether to enqueue this addon's styling. */ public function do_enqueue() { /** * Filter whether to enqueue this add-on's styling. * * @param boolean $do_enqueue Whether to enqueue styling. */ $do_enqueue = apply_filters( 'aga_do_enqueue_css', $this->do_enqueue_add_on_styling_by_default ); return ( $do_enqueue && ( ! is_admin() ) ); } }