PHP code example of wp-content-framework / admin

1. Go to this page and download the library: Download wp-content-framework/admin library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

wp-content-framework / admin example snippets




namespace Example_Plugin\Classes\Controllers\Admin;

if ( ! defined( 'EXAMPLE_PLUGIN' ) ) {
	exit;
}

class Test extends \WP_Framework\Classes\Controllers\Admin\Base {

	// タイトル
	public function get_page_title() {
		return 'Test';
	}

	// GET の時に行う動作
	protected function get_action() {

	}

	// POST の時に行う動作
	protected function post_action() {
		$aaa = $this->app->input->post( 'aaa' );
		// ...
	}

	// GET, POST 共通で行う動作
	protected function common_action() {
		// wp_enqueue_script('media-upload');
	}

	// view に渡す変数設定
	public function get_view_args() {
		return array(
			'test' => 'aaaa',
		);
	}
}



if ( ! defined( 'EXAMPLE_PLUGIN' ) ) {
	return;
}
/** @var \WP_Framework\Interfaces\Presenter $instance */
/** @var string $test */

protected function get_help_contents() {
    return array(
        array(
            'title' => 'Test',
            'view'  => 'test',
        )
    );
}



if ( ! defined( 'EXAMPLE_PLUGIN' ) ) {
	return;
}
/** @var \WP_Framework\Interfaces\Presenter $instance */