Skip to content

Instantly share code, notes, and snippets.

@kirillrocks
Created March 2, 2020 20:23
Show Gist options
  • Save kirillrocks/f3df18a5ee8b8f5726ec983e62bfe9e1 to your computer and use it in GitHub Desktop.
Save kirillrocks/f3df18a5ee8b8f5726ec983e62bfe9e1 to your computer and use it in GitHub Desktop.
<?php
/**
* Created by CODEJA.
* User: kirillrocks
* Date: 02-Mar-20
* Time: 21:39
*/
define( 'POST_TYPE_CHILDREN', 'children' );
define( 'POST_TYPE_AUDITIONS', 'auditions' );
// Profile information
$profile = [
'name' => 'display_name',
'actions' => [ 'edit' ],
'profile_fields' => $profile_fields
];
// Fields the user can edit about his profile
$profile_fields = [
'first_name' => [
'title' => 'Your name',
'type' => 'text',
],
'last_name' => [
'title' => 'Your lastname',
'type' => 'text',
],
'personal_id' => [
'title' => 'Your Personal ID',
'type' => 'text',
],
'user_phone' => [
'title' => 'Phone',
'type' => 'text',
'callback' => 'function_callback' // If needed
],
];
// For pages in the header
$pages = [
POST_TYPE_CHILDREN => [
'title' => 'My Children',
'description' => 'description text',
'actions' => [
'add' => true,
'run' => 'function_callback' // if needed
],
'table' => $tables[ POST_TYPE_CHILDREN ]
],
POST_TYPE_AUDITIONS => [
'title' => 'My Auditions',
'description' => 'description text',
'table' => $tables[ POST_TYPE_AUDITIONS ],
],
];
// Tables that appear on the page
$tables = [
POST_TYPE_CHILDREN => [
'post_type' => 'children',
'order_by' => 'title',
'order' => 'ABC',
'checkbox' => true,
'actions' => [ 'view', 'edit', 'delete' ],
'table_fields' => $table_fields[ POST_TYPE_CHILDREN ],
'add_fields' => $add_fields[ POST_TYPE_CHILDREN ],
'edit_fields' => $edit_fields[ POST_TYPE_CHILDREN ],
]
];
// Fields for the table that appears on the page
$table_fields = [
POST_TYPE_CHILDREN => [
'title' => [
'title' => 'Kid Name',
'type' => 'text',
],
'children_sex' => [
'title' => 'Children sex',
'type' => 'text',
],
'children_id' => [
'title' => 'Children id',
'type' => 'text',
],
'children_shirt_size' => [
'title' => 'Children Shirt Size',
'type' => 'text',
'callback' => 'function_callback' // If needed
],
]
];
// Fields that the user can add
$add_fields = [
POST_TYPE_CHILDREN => [
'title' => [
'title' => 'Kid Name',
'type' => 'text',
],
'children_sex' => [
'title' => 'Children sex',
'type' => 'text',
],
'children_id' => [
'title' => 'Children id',
'type' => 'text',
],
'children_shirt_size' => [
'title' => 'Children Shirt Size',
'type' => 'text',
'callback' => 'function_callback' // If needed
],
]
];
// Fields that the user can edit
$edit_fields = [
POST_TYPE_CHILDREN => [
'title' => [
'title' => 'Kid Name',
'type' => 'text',
],
'children_sex' => [
'title' => 'Children sex',
'type' => 'text',
],
'children_id' => [
'title' => 'Children id',
'type' => 'text',
],
'children_shirt_size' => [
'title' => 'Children Shirt Size',
'type' => 'text',
'callback' => 'function_callback' // If needed
],
]
];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment