Making WordPress.org


Ignore:
Timestamp:
01/27/2015 12:28:19 AM (9 years ago)
Author:
coffee2code
Message:

developer.wordpress.org: Register P2P post relationships. See #323.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/registrations.php

    r1193 r1194  
    2727        // Register taxonomies.
    2828        self::register_taxonomies();
     29
     30        // Register P2P relationships.
     31        add_action( 'p2p_init', array( __CLASS__, 'register_post_relationships' ) );
    2932    }
    3033
     
    212215    }
    213216
     217    /**
     218     * Registers P2P post relationships.
     219     */
     220    public static function register_post_relationships() {
     221
     222        /*
     223         * Functions to functions, methods and hooks
     224         */
     225        p2p_register_connection_type( array(
     226            'name'             => 'functions_to_functions',
     227            'from'             => 'wp-parser-function',
     228            'to'               => 'wp-parser-function',
     229            'can_create_post'  => false,
     230            'self_connections' => true,
     231            'from_query_vars'  => array( 'orderby' => 'post_title', 'order' => 'ASC' ),
     232            'to_query_vars'    => array( 'orderby' => 'post_title', 'order' => 'ASC' ),
     233            'title'            => array( 'from' => __( 'Uses Functions', 'wporg' ), 'to' => __( 'Used by Functions', 'wporg' ) ),
     234        ) );
     235
     236        p2p_register_connection_type( array(
     237            'name'             => 'functions_to_methods',
     238            'from'             => 'wp-parser-function',
     239            'to'               => 'wp-parser-method',
     240            'can_create_post'  => false,
     241            'from_query_vars'  => array( 'orderby' => 'post_title', 'order' => 'ASC' ),
     242            'to_query_vars'    => array( 'orderby' => 'post_title', 'order' => 'ASC' ),
     243            'title'            => array( 'from' => __( 'Uses Methods', 'wporg' ), 'to' => __( 'Used by Functions', 'wporg' ) ),
     244        ) );
     245
     246        p2p_register_connection_type( array(
     247            'name'             => 'functions_to_hooks',
     248            'from'             => 'wp-parser-function',
     249            'to'               => 'wp-parser-hook',
     250            'can_create_post'  => false,
     251            'from_query_vars'  => array( 'orderby' => 'post_title', 'order' => 'ASC' ),
     252            'to_query_vars'    => array( 'orderby' => 'post_title', 'order' => 'ASC' ),
     253            'title'            => array( 'from' => __( 'Uses Hooks', 'wporg' ), 'to' => __( 'Used by Functions', 'wporg' ) ),
     254        ) );
     255
     256        /*
     257         * Methods to functions, methods and hooks
     258         */
     259        p2p_register_connection_type( array(
     260            'name'             => 'methods_to_functions',
     261            'from'             => 'wp-parser-method',
     262            'to'               => 'wp-parser-function',
     263            'can_create_post'  => false,
     264            'from_query_vars'  => array( 'orderby' => 'post_title', 'order' => 'ASC' ),
     265            'to_query_vars'    => array( 'orderby' => 'post_title', 'order' => 'ASC' ),
     266            'title'            => array( 'from' => __( 'Uses Functions', 'wporg' ), 'to' => __( 'Used by Methods', 'wporg' ) ),
     267        ) );
     268
     269        p2p_register_connection_type( array(
     270            'name'             => 'methods_to_methods',
     271            'from'             => 'wp-parser-method',
     272            'to'               => 'wp-parser-method',
     273            'can_create_post'  => false,
     274            'self_connections' => true,
     275            'from_query_vars'  => array( 'orderby' => 'post_title', 'order' => 'ASC' ),
     276            'to_query_vars'    => array( 'orderby' => 'post_title', 'order' => 'ASC' ),
     277            'title'            => array( 'from' => __( 'Uses Methods', 'wporg' ), 'to' => __( 'Used by Methods', 'wporg' ) ),
     278        ) );
     279
     280        p2p_register_connection_type( array(
     281            'name'             => 'methods_to_hooks',
     282            'from'             => 'wp-parser-method',
     283            'to'               => 'wp-parser-hook',
     284            'can_create_post'  => false,
     285            'from_query_vars'  => array( 'orderby' => 'post_title', 'order' => 'ASC' ),
     286            'to_query_vars'    => array( 'orderby' => 'post_title', 'order' => 'ASC' ),
     287            'title'            => array( 'from' => __( 'Used by Methods', 'wporg' ), 'to' => __( 'Uses Hooks', 'wporg' ) ),
     288        ) );
     289
     290    }
     291
    214292} // DevHub_Registrations
    215293
Note: See TracChangeset for help on using the changeset viewer.