Skip to content

Instantly share code, notes, and snippets.

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 badabingbreda/d40930faaedd712e02392aba2fefa2ca to your computer and use it in GitHub Desktop.
Save badabingbreda/d40930faaedd712e02392aba2fefa2ca to your computer and use it in GitHub Desktop.
Toolbox Example - Adding your own set of SC Attribute Defaults
<?php
add_filter( 'toolbox/helpers/sc_attr/type=new_fieldtype', 'my_own_attr_defaults' , 10 , 1 );
function my_own_attr_defaults ( $attr = array() ) {
$new_attr = array(
'field' => '',
'format' => null,
'allowempty' => 'false',
'postid' => 0,
'nodeid' => null, // beaver builder node id
'twigtemplate' => false,
);
return array_merge ( $attr , $new_attr );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment