Skip to content

Instantly share code, notes, and snippets.

@jaspertandy
Created September 13, 2013 16:46

Revisions

  1. jaspertandy created this gist Sep 13, 2013.
    36 changes: 36 additions & 0 deletions mcp.freeform.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,36 @@
    $default_hide = array('site_id', 'entry_id', 'complete');

    foreach ($default_hide as $hide_me_seymour)
    {
    if (in_array($hide_me_seymour, $visible_columns))
    {
    unset(
    $visible_columns[
    array_search(
    $hide_me_seymour,
    $visible_columns
    )
    ]
    );
    }
    }

    $form_id = ee()->input->get('form_id');
    $layout = $this->composer_field_order( $form_id );

    if ( $layout ) {
    $sorted = array();
    $top = array();

    foreach ( $visible_columns as $column ) {
    preg_match( '#[0-9]+$#' , $column , $match );
    if ( $match ) {
    $sorted[ array_search( $match[0] , $layout ) ] = $column;
    } else {
    $top[] = $column;
    }
    }
    ksort( $sorted );

    $visible_columns = array_merge( $top , $sorted );
    }