You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

93 lines
2.4 KiB

<?php
/**
* The admin-specific functionality of the plugin.
*
* @link https://horizontes.info
* @since 1.0.0
*
* @package Cf7_States_Cities
* @subpackage Cf7_States_Cities/admin
*/
/**
* The admin-specific functionality of the plugin.
*
* Defines the plugin name, version, and two examples hooks for how to
* enqueue the admin-specific stylesheet and JavaScript.
*
* @package Cf7_States_Cities
* @subpackage Cf7_States_Cities/admin
* @author Horizontes Coop. <contato@horizontes.info>
*/
class Cf7_States_Cities_Admin {
/**
* The ID of this plugin.
*
* @since 1.0.0
* @access private
* @var string $plugin_name The ID of this plugin.
*/
private $plugin_name;
/**
* The version of this plugin.
*
* @since 1.0.0
* @access private
* @var string $version The current version of this plugin.
*/
private $version;
/**
* Initialize the class and set its properties.
*
* @since 1.0.0
* @param string $plugin_name The name of this plugin.
* @param string $version The version of this plugin.
*/
public function __construct( $plugin_name, $version ) {
$this->plugin_name = $plugin_name;
$this->version = $version;
}
/**
* Add the state tag button to the CF7 form editor
*
* @since 1.0.0
*/
public function add_state_tag_generator_menu() {
$tag_generator = WPCF7_TagGenerator::get_instance();
$tag_generator->add( 'state', __( 'state', 'cf7-states-cities' ),
array($this, 'tag_generator_menu') );
}
/**
* Add the city tag button to the CF7 form editor
*
* @since 1.0.0
*/
public function add_city_tag_generator_menu() {
$tag_generator = WPCF7_TagGenerator::get_instance();
$tag_generator->add( 'city', __( 'city', 'cf7-states-cities' ),
array($this, 'tag_generator_menu') );
}
/**
* The tag generator form for the state and city tags
*
* @since 1.0.0
*/
public function tag_generator_menu( $contact_form, $args = '' ) {
$args = wp_parse_args( $args, array() );
$description = __( "Generate a form-tag for a drop-down menu. For more details, see %s.", 'contact-form-7' );
$desc_link = wpcf7_link( __( 'https://contactform7.com/checkboxes-radio-buttons-and-menus/', 'contact-form-7' ), __( 'Checkboxes, radio buttons and menus', 'contact-form-7' ) );
include plugin_dir_path( __FILE__ ) . 'partials/tag-generator.php';
}
}