Skip to content

Instantly share code, notes, and snippets.

@fastlinemedia
Last active December 5, 2018 19:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fastlinemedia/fe9b58af76ac93b37d3ccfd91e4f14c6 to your computer and use it in GitHub Desktop.
Save fastlinemedia/fe9b58af76ac93b37d3ccfd91e4f14c6 to your computer and use it in GitHub Desktop.
<?php
function filter_bb_layout_data( $nodes ) {
// Loop through the nodes.
foreach ( $nodes as $node_id => $node ) {
// Update row settings.
if ( 'row' === $node->type ) {
// Check for the old setting to update.
if ( isset( $node->settings->old_setting ) ) {
// Change an old setting to a new setting.
$node->settings->new_setting = $node->settings->old_setting;
// Make sure to unset the old setting so this doesn't run again.
unset( $node->settings->old_setting );
}
// Save the update settings.
$nodes[ $node_id ]->settings = $node->settings;
}
}
// Don't forget to return the settings when you're done!
return $nodes;
}
add_filter( 'fl_builder_get_layout_metadata', 'filter_bb_layout_data' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment