Plugin Directory

Changeset 1079928


Ignore:
Timestamp:
02/01/2015 04:15:55 AM (11 years ago)
Author:
irenem
Message:

Updated basefield api.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • conditional-logic-solution/trunk/lib/basefield.php

    r1072545 r1079928  
    4545                        'name' => '',
    4646                        'id' => '',
     47                        'div_class' => '',
    4748                        'echo' => true
    4849                ));
     
    5657                extract( $args );
    5758               
    58                 foreach( array('label', 'sub', 'choices', 'echo', 'buttons', 'before', 'after', 'selected' ) as $extra ){ unset( $args[$extra]); }
     59                foreach( array('div_class', 'label', 'sub', 'choices', 'echo', 'buttons', 'before', 'after', 'selected' ) as $extra ){ unset( $args[$extra]); }
     60               
    5961                $label_class = apply_filters( 'basefield_label_class', array('bf-title') );
    6062                $label_attr = array('class' => implode(" ", $label_class));
     
    179181                $html .= $after;
    180182               
    181                 if( !empty( $sub ) ){
    182                         $html .= basefield_tag( 'i', array('class' => 'bf-sub'), $sub );
    183                 }
     183                if( !empty( $sub ) ) $html .= basefield_tag( 'p', array('class' => 'bf-sub'), $sub );
     184                     
    184185                $name = preg_replace('%[\[\]]%', '', $name);
    185186                $name = empty($name) ? $id : $name;
    186                 $html = basefield_tag('div', apply_filters( 'basefield_wrapper', array('class' => 'bf-div bf-'. $name ), $html, $args ), $html );
     187                $div_class = explode(' ', $div_class);
     188                $div_class[] = 'bf-' . $name;
     189                array_unshift( $div_class, 'bf-div' );
     190               
     191                $div_args = array('class' => implode(' ', $div_class ) );
     192               
     193                if( $type == 'html' ) $div_args = wp_parse_args( $div_args, $args );
     194               
     195                unset( $div_args['type'] );
     196               
     197                $html = basefield_tag('div', apply_filters( 'basefield_wrapper',  $div_args, $html, $args ), $html );
    187198                if( $echo ) _e( $html );
    188199                else return $html;
Note: See TracChangeset for help on using the changeset viewer.