Skip to content

Instantly share code, notes, and snippets.

@jaspertandy
Created September 13, 2013 16:41
Show Gist options
  • Save jaspertandy/6553063 to your computer and use it in GitHub Desktop.
Save jaspertandy/6553063 to your computer and use it in GitHub Desktop.
public function composer_field_order( $form_id ){
$composer = ee()->db->select('composer_id')
->where('form_id' , $form_id)
->get('freeform_forms')
->row()
->composer_id;
$layout = ee()->db->select('composer_data')
->where('composer_id' , $composer)
->get('freeform_composer_layouts')
->row();
if ( $layout ) {
$layout = json_decode( $layout->composer_data );
$order = array();
foreach ( $layout->rows as $row ) {
foreach ( $row as $fields ) {
foreach ( $fields as $field ) {
if ( isset( $field->fieldId ) ) {
$order[] = $field->fieldId;
}
}
}
}
return $order;
}
return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment