Skip to content

Instantly share code, notes, and snippets.

@jasonbahl
Last active January 14, 2016 21:57
Show Gist options
  • Save jasonbahl/f6d1d50e6cd5cac63352 to your computer and use it in GitHub Desktop.
Save jasonbahl/f6d1d50e6cd5cac63352 to your computer and use it in GitHub Desktop.
$layout_settings = new Fieldmanager_Group(
array(
'name' => 'layout_settings',
'label' => __( 'Configure Page Layout & Zones', 'mason' ),
'serialize_data' => false,
'children' => array(
'layout' => new Fieldmanager_Select(
array(
'name' => 'layout',
'label' => __( 'Layout', 'mason' ),
'inline_label' => true,
'description' => __( 'Choose the layout for this term', 'mason' ),
'options' => array(
'simple' => __( 'Simple', 'mason' ),
'featured' => __( 'Featured', 'mason' )
)
)
),
'zones' => new Fieldmanager_Group(
array(
'minimum_count' => 8,
'limit' => 8,
'sortable' => true,
'label' => __( 'Zones: Please set 8 child-zones to populate this section\'s page', 'mason' ),
'collapsible' => true,
'add_more_label' => __( 'Add Zone', 'mason' ),
'display_if' => array(
'src' => 'layout',
'value' => 'featured'
),
'children' => array(
'data_source' => new Fieldmanager_Select(
array(
'name' => 'data_source',
'inline_label' => true,
'label' => __( 'Data Source', 'mason' ),
'description' => __( 'Select if this section should populate from a Section or Tag', 'mason' ),
'first_empty' => false,
'default_value' => 'category',
'options' => array(
'category' => __( 'Sections', 'mason' ),
'post_tag' => __( 'Tags', 'mason' )
)
)
),
'zone_tag' => new Fieldmanager_Select(
array(
'name' => 'zone_tag',
'label' => __( 'Set the Tag', 'mason' ),
'inline_label' => true,
'description' => __( '', 'mason' ),
'display_if' => array(
'src' => 'data_source',
'value' => 'post_tag'
),
'sortable' => false,
// note first_empty won't work on child elements until field manager issue is resolved
'first_empty' => false,
'datasource' => new Fieldmanager_Datasource_Term(
array(
'taxonomy' => 'post_tag',
'taxonomy_args' => array(
'hide_empty' => true
)
)
)
)
),
'zone_section' => new Fieldmanager_Select(
array(
'name' => 'zone_section',
'label' => __( 'Set the Section', 'mason' ),
'inline_label' => true,
'description' => __( '', 'mason' ),
'display_if' => array(
'src' => 'data_source',
'value' => 'category'
),
'sortable' => false,
// note first_empty won't work on child elements until field manager issue is resolved
'first_empty' => false,
'datasource' => new Fieldmanager_Datasource_Term(
array(
'taxonomy' => 'category',
'taxonomy_args' => array(
'hide_empty' => true
)
)
)
)
)
)
)
)
)
)
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment