Skip to content

Commit

Permalink
convert all markup to divs instead of ul/li. Also update all html cla…
Browse files Browse the repository at this point in the history
…sses to consistently use hyphens instead of underscores
  • Loading branch information
jtsternberg committed Sep 16, 2014
1 parent f4074f1 commit be026f7
Show file tree
Hide file tree
Showing 14 changed files with 661 additions and 649 deletions.
32 changes: 16 additions & 16 deletions CMB2.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ public function show_form( $object_id = 0, $object_type = '' ) {
*/
do_action( 'cmb2_before_form', $this->cmb_id, $object_id, $object_type, $this );

echo '<div class="cmb2_wrap form-table"><ul id="cmb2_metabox_'. sanitize_html_class( $this->cmb_id ) .'" class="cmb2_metabox">';
echo '<div class="cmb2-wrap form-table"><div id="cmb2-metabox-'. sanitize_html_class( $this->cmb_id ) .'" class="cmb2-metabox cmb-field-list">';

foreach ( $this->prop( 'fields' ) as $field_args ) {

Expand Down Expand Up @@ -165,7 +165,7 @@ public function show_form( $object_id = 0, $object_type = '' ) {
}
}

echo '</ul></div>';
echo '</div></div>';

$this->render_hidden_fields();

Expand Down Expand Up @@ -205,15 +205,15 @@ public function render_group( $args ) {
$nrows = count( $group_val );
$remove_disabled = $nrows <= 1 ? 'disabled="disabled" ' : '';

echo '<li class="cmb-row cmb-repeat-group-wrap"><div class="cmb-td"><ul id="', $field_group->id(), '_repeat" class="cmb-nested repeatable-group'. $sortable .'" style="width:100%;">';
echo '<div class="cmb-row cmb-repeat-group-wrap"><div class="cmb-td"><div id="', $field_group->id(), '_repeat" class="cmb-nested cmb-field-list repeatable-group'. $sortable .'" style="width:100%;">';
if ( $desc || $label ) {
$class = $desc ? ' cmb-group-description' : '';
echo '<li class="cmb-row'. $class .'"><div class="cmb-th">';
echo '<div class="cmb-row'. $class .'"><div class="cmb-th">';
if ( $label )
echo '<h2 class="cmb-group-name">'. $label .'</h2>';
if ( $desc )
echo '<p class="cmb2_metabox_description">'. $desc .'</p>';
echo '</div></li>';
echo '<p class="cmb2-metabox-description">'. $desc .'</p>';
echo '</div></div>';
}

if ( ! empty( $group_val ) ) {
Expand All @@ -225,25 +225,25 @@ public function render_group( $args ) {
$this->render_group_row( $field_group, $remove_disabled );
}

echo '<li class="cmb-row"><div class="cmb-td"><p class="add-row"><button data-selector="', $field_group->id() ,'_repeat" data-grouptitle="', $field_group->options( 'group_title' ) ,'" class="add-group-row button">'. $field_group->options( 'add_button' ) .'</button></p></div></li>';
echo '<div class="cmb-row"><div class="cmb-td"><p class="add-row"><button data-selector="', $field_group->id() ,'_repeat" data-grouptitle="', $field_group->options( 'group_title' ) ,'" class="add-group-row button">'. $field_group->options( 'add_button' ) .'</button></p></div></div>';

echo '</ul></div></li>';
echo '</div></div></div>';

}

public function render_group_row( $field_group, $remove_disabled ) {

echo '
<li class="cmb-row repeatable-grouping" data-iterator="'. $field_group->count() .'">
<div class="cmb-row repeatable-grouping" data-iterator="'. $field_group->count() .'">
<div class="cmb-td">
<ul class="cmb-nested" style="width: 100%;">';
<div class="cmb-nested cmb-field-list" style="width: 100%;">';
if ( $field_group->options( 'group_title' ) ) {
echo '
<li class="cmb-row cmb-group-title">
<div class="cmb-row cmb-group-title">
<div class="cmb-th">
', sprintf( '<h4>%1$s</h4>', $field_group->replace_hash( $field_group->options( 'group_title' ) ) ), '
</div>
</li>
</div>
';
}
// Loop and render repeatable group fields
Expand All @@ -268,14 +268,14 @@ public function render_group_row( $field_group, $remove_disabled ) {
}
}
echo '
<li class="cmb-row remove-field-row">
<div class="cmb-row remove-field-row">
<div class="remove-row">
<button '. $remove_disabled .'data-selector="'. $field_group->id() .'_repeat" class="button remove-group-row alignright">'. $field_group->options( 'remove_button' ) .'</button>
</div>
</li>
</ul>
</div>
</div>
</div>
</li>
</div>
';

$field_group->args['count']++;
Expand Down
Loading

0 comments on commit be026f7

Please sign in to comment.