/** * Constructor. Set up the properties. * * @wp-hook plugins_loaded * * @param Inpsyde_Property_List_Interface $plugin_data Plugin data. * @param Setting $setting Setting object. * @param Nonce $nonce Nonce object. */ public function __construct(Inpsyde_Property_List_Interface $plugin_data, Setting $setting, Nonce $nonce) { $this->plugin_data = $plugin_data; $this->setting = $setting; $this->nonce = $nonce; add_action('admin_post_' . $setting->action(), [$this, 'update_settings']); $this->page_properties = new Mlp_Network_Site_Settings_Properties(); add_action('admin_print_styles-' . $this->page_properties->get_param_value(), [$this, 'enqueue_stylesheet']); new Mlp_Network_Site_Settings($this->page_properties, $this); }
/** * Callback for page output. * */ public function render() { $current_page = $this->pagination_data->get_current_page(); ?> <div class="wrap"> <h1><?php echo esc_html($this->setting->title()); ?> </h1> <?php $this->watcher->update('before_form'); ?> <form action="<?php echo esc_url($this->setting->url()); ?> " method="post"> <input type="hidden" name="action" value="<?php echo esc_attr($this->setting->action()); ?> "> <input type="hidden" name="paged" value="<?php echo esc_attr($current_page); ?> "> <?php echo \Inpsyde\MultilingualPress\nonce_field($this->nonce); ?> <?php $this->watcher->update('before_table'); ?> <?php $this->watcher->update('show_table'); ?> <?php $this->watcher->update('after_table'); ?> <?php submit_button(esc_attr__('Save changes', 'multilingual-press'), 'primary', 'save', false, ['style' => 'float:left']); ?> <?php $this->watcher->update('after_form_submit_button'); ?> </form> <?php $this->watcher->update('after_form'); ?> </div> <?php }
/** * Print tab content and provide two hooks. * * @return void */ public function render_content() { ?> <form action="<?php echo $this->setting->url(); ?> " method="post"> <input type="hidden" name="action" value="<?php echo esc_attr($this->setting->action()); ?> " /> <input type="hidden" name="id" value="<?php echo esc_attr($this->blog_id); ?> " /> <?php echo \Inpsyde\MultilingualPress\nonce_field($this->nonce); $siteoption = get_site_option('inpsyde_multilingual', []); echo '<table class="form-table mlp-admin-settings-table">'; $this->show_language_options($siteoption, $this->languages->get_all_languages()); $this->show_blog_relationships($siteoption); /** * Runs at the end of but still inside the site settings table. * * @param int $blog_id Blog ID. */ do_action('mlp_blogs_add_fields', $this->blog_id); if (has_action('mlp_blogs_add_fields_secondary')) { _doing_it_wrong('mlp_blogs_add_fields_secondary', 'mlp_blogs_add_fields_secondary is deprecated, use mlp_blogs_add_fields instead.', '2.1'); } /** * @see mlp_blogs_add_fields * @deprecated */ do_action('mlp_blogs_add_fields_secondary', $this->blog_id); echo '</table>'; submit_button(); ?> </form> <?php }