Skip to:
Content
Pages
Categories
Search
Top
Bottom

Forum Replies Created

Viewing 9 replies - 1 through 9 (of 9 total)
  • @jamescushing

    Participant

    Hi Varun,

    You’re correct, it was nothing to do with Gutenberg in the end. It turns out a function I had hooked into script_loader_tag wasn’t properly functioning.

    See an answer I posted to a similar question on Stack Overflow

    @jamescushing

    Participant

    The above also works for the profile edit screen

    (Sorry for the double-post but I assume editing the original would have deleted it again somehow…)

    @jamescushing

    Participant

    I posted a solution here a couple mins ago but it got deleted when I edited it… odd…

    Anyway, sorry @venutius I only just logged in to see your reply – I came up with the rather-inelegant solution of using XPath in the end:

    
    $field_type = bp_xprofile_create_field_type( bp_get_the_profile_field_type() );
    
    if( bp_get_the_profile_field_type() == 'checkbox' ){
    
    	// Buffer output for modifying checkboxes
    	ob_start();
    
    		// Generate the field's html
    		$field_type->edit_field_html();
    
    		// Store the html
    		$field_html = ob_get_contents();
    
    	ob_end_clean();
    
    	$dom = new DOMDocument;
    	$dom->loadHTML( $field_html );
    
    	$div = $dom->createElement( 'div' );
    	$div->setAttribute( 'class', 'col-xs-6 col-sm-4 checkbox' );
    
    	$xpath = new DOMXPath( $dom );
    	$labels = $xpath->query( "//label[contains(@class, 'option-label')]" );
    
    	foreach( $labels as $label ){
    
    		$div_clone = $div->cloneNode();
    
    		$label->parentNode->replaceChild( $div_clone, $label );
    	
    		$div_clone->appendChild( $label );
    
    	}
    
    	echo $dom->saveHTML();
    
    }else{
    
    	// Generate the field's html
    	$field_type->edit_field_html(array(
    		'class' => 'form-control'
    	));
    
    }
    

    @jamescushing

    Participant

    @venutius I see what you mean now. I’m currently looking into the xprofile field object’s edit_field_html method and passing params into that. I’ll update here if and when I find a suitable solution

    @jamescushing

    Participant

    @venutius Any idea on this?

    @jamescushing

    Participant

    Yeah I know about that, thanks though. What about all the xprofile fields?

    @jamescushing

    Participant

    @venutius Thanks for replying

    I’m using a css framework as mentioned above, which uses its own preset CSS classes (e.g “form-control”) to standardise appearence. It’s classes I’m trying to add, not CSS for existing classes

    Thanks

    @jamescushing

    Participant

    Bump… how hard can this be, really? or at least a “no” of some kind so I’m not stuck waiting…

    @jamescushing

    Participant

    Bump

Viewing 9 replies - 1 through 9 (of 9 total)
Skip to toolbar