Le mirroring des dépôts vers Github est maintenant natif dans Gitlab (et donc Framagit). Merci de passer à la fonction native pour que nous puissions couper notre solution maison. Détails sur https://docs.gitlab.com/ee/workflow/repository_mirroring.html#pushing-to-a-remote-repository (pensez à supprimer le webhook de notre solution maison).

Commit 98d0762e by Cyrille37

move custom field code

parent 2c5d6ed6
......@@ -47,7 +47,6 @@ class CommunityProject
add_action( 'admin_menu', array( $this, 'remove_meta_boxes' ) );
add_action( 'admin_menu', array( $this, 'redirect_if_not_author' ) );
add_action( 'add_meta_boxes', array( $this, 'add_custom_fields' ) );
add_action( 'do_meta_boxes', array( $this, 'remove_edit_flow_metabox' ) );
add_action( 'after_setup_theme', array( $this, 'remove_admin_bar') );
......@@ -126,26 +125,6 @@ class CommunityProject
}
}
/**
* Add custom field to project custom type
*/
function add_custom_fields()
{
add_meta_box(
'budget',
'Budget',
array( $this, 'display_custom_field' ),
'project',
'normal',
'default',
[
'id' => 'budget',
'label' => 'Montant €',
'post_id' => get_post()->ID
]
);
}
function save_custom_meta_box( $post_id, $post, $update )
{
if( $post->post_type !== self::CPT_TYPE )
......@@ -167,18 +146,6 @@ class CommunityProject
}
}
/**
* Display customs fields in "add project" page
* @param $post
* @param $metabox
*/
function display_custom_field( $post, $metabox )
{
ob_start();
include 'templates/custom_field.php';
echo ob_get_clean();
}
}
new CommunityProject();
......@@ -4,8 +4,46 @@ namespace CommunityProject ;
class ProjectCustomTypeCreator
{
function create_project_post_type()
{
public function __construct()
{
add_action( 'add_meta_boxes', array( $this, 'custom_field_meta_boxe' ) );
}
/**
* Add custom field to project custom type
*/
function custom_field_meta_boxe()
{
add_meta_box(
'budget',
'Budget',
array( $this, 'custom_field_display' ),
'project',
'normal',
'default',
[
'id' => 'budget',
'label' => 'Montant €',
'post_id' => get_post()->ID
]
);
}
/**
* Display customs fields in "add project" page
* @param $post
* @param $metabox
*/
function custom_field_display( $post, $metabox )
{
ob_start();
include __DIR__.'/templates/custom_field.php';
echo ob_get_clean();
}
function create_project_post_type()
{
register_post_type( 'project',
[
'labels' => [
......@@ -125,4 +163,5 @@ class ProjectCustomTypeCreator
);
}
}
}
......@@ -9,9 +9,9 @@ class UserRoleController
function set_user_role_permission()
{
// TODO: https://framagit.org/Artefacts/CommunityVoice/issues/61
$this->grant_all_project_permission( get_role( 'author' ) );
$this->grant_all_project_permission( get_role( 'editor' ) );
$this->grant_all_project_permission( get_role( 'administrator' ) );
$this->grant_all_project_permission( get_role( 'author' ) );
$this->grant_all_project_permission( get_role( 'editor' ) );
$this->grant_all_project_permission( get_role( 'administrator' ) );
}
function grant_all_project_permission( $role )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment