Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #888519

    i don’t want to loose my modifications i put in on next update – so is there a way to have a child-theme register-backend-advanced-styles.php ?
    (for example – i wanted to have the same settings for blockquote as on h1 ( including font-family etc). So i did change the edit array)
    Thanks

    to be precise: there is an include instruction in register-admin-options.php :
    include('register-backend-advanced-styles.php');

    is there a hook to have not loaded that file and include a child-theme file here?

    • This topic was modified 6 years, 10 months ago by Guenni007.
    #890272

    Hey Guenter,

    As that is something not so simple, I have assigned our main developer to the ticket.
    He will do take a look and assist if possible.

    Thank you

    Best regards,
    Basilis

    #890408

    Hi,

    A direct hook at the moment – no.

    But $advanced is assigned to $avia_elements[] in enfold\includes\admin\register-admin-options.php line 1173ff and you have in file enfold\framework\php\class-superobject.php line 118 the following filter:

    
    if(isset($avia_elements)) $this->option_page_data = apply_filters( 'avf_option_page_data_init', $avia_elements);
    

    If this does not help let me know and we can add filters to change the path to the include files in the core for the next release.

    Best regards,
    Günter

    #890557

    yes what i thought if we can redefine the path to it

    in register-admin-options.php there is that include('register-backend-advanced-styles.php');

    yes i can change it here by manual typing – but than it will be lost on updating the parent theme.
    but maybe there is a way to change the edit array of a given setting via hook

    i changed to have the option to set for blockquote the font-family (which is missing on default) f.e. :

    $advanced['blockquote'] = array(
    	"id"			=> "blockquote", //needs to match array key
    	"name"			=> "<blockquote>",
    	"group" 		=> __("HTML Tags",'avia_framework'),
    	"description"	=> __("Change the styling for all <blockquote> tags",'avia_framework'),
    	"selector"		=> array("#top [sections] blockquote"=> ""),
    	"sections"		=> true,
    	"hover"			=> false,
    	"edit"			=> array(	
    		'font_family' 		=> array('type' => 'font', 'name'=> __("Font Family",'avia_framework'), 'options' => $google_fonts),
    		'font_size' 		=> array('type' => 'size', 'range' => '8-80', 'name'=> __("Font Size",'avia_framework')),
    		'line_height' 		=> array('type' => 'size', 'range' => '0.7-2', 'increment' => 0.1, 'unit' => 'em',  'name'=> __("Line Height",'avia_framework')),
    		'font_weight' 		=> array('type' => 'select', 'name'=> __("Font Weight",'avia_framework'), 'options' => $weight),
    		'text_transform' 	=> array('type' => 'select', 'name'=> __("Text Transform",'avia_framework'), 'options' => $transform ),
    		'color' 			=> array('type' => 'colorpicker', 'name'=> __("Font Color",'avia_framework')),							
    								)
    );
    #890742

    Hi,

    I have added a filter:

    
    
    /**
     * Allow to include a user defined file to add or alter backend styles
     * 
     * @since 4.2.1
     * @return string		full path to the include file ( not a relative path !!! )
     */
    $custom_path = apply_filters( 'avf_register_custom_backend_styles', '' );
    if( ! empty( $custom_path ) && file_exists( $custom_path ) )
    {
    	include_once $custom_path;
    }
    
    

    The modified file you find here for download:

    https://github.com/KriesiMedia/enfold-library/blob/master/temp_fixes/Enfold_4_2/register-admin-options.php

    Should be included in the next update, when Kriesi approves it.

    In your file you only need to modify or add the values you need.

    Best regards,
    Günter

    #890771

    so i do create a folder on child-theme ( maybe : includes) –
    i make a file f.e: register-custom-advanced-styles.php and upload it to that child-theme/includes folder

    content is f.e.:

    <?php
    $advanced['blockquote'] = array(
    	"id"			=> "blockquote", //needs to match array key
    	"name"			=> "<blockquote>",
    	"group" 		=> __("HTML Tags",'avia_framework'),
    	"description"	=> __("Change the styling for all <blockquote> tags",'avia_framework'),
    	"selector"		=> array("#top [sections] blockquote"=> ""),
    	"sections"		=> true,
    	"hover"			=> false,
    	"edit"			=> array(	'font_family' 		=> array('type' => 'font', 'name'=> __("Font Family",'avia_framework'), 'options' => $google_fonts),
    								'font_size' 		=> array('type' => 'size', 'range' => '8-80', 'name'=> __("Font Size",'avia_framework')),
    								'line_height' 		=> array('type' => 'size', 'range' => '0.7-2', 'increment' => 0.1, 'unit' => 'em',  'name'=> __("Line Height",'avia_framework')),
    								'font_weight' 		=> array('type' => 'select', 'name'=> __("Font Weight",'avia_framework'), 'options' => $weight),
    								'text_transform' 	=> array('type' => 'select', 'name'=> __("Text Transform",'avia_framework'), 'options' => $transform ),
    								'color' 			=> array('type' => 'colorpicker', 'name'=> __("Font Color",'avia_framework')),							
    								)
    );

    so what do i do now ?

    #890812

    Hi,

    In functions.php of the child theme add the filter hook:

    
    
    add_filter( 'avf_register_custom_backend_styles', 'my_include', 10, 1 );
    
    function my_include( $path = '' )
    {
    	return get_stylesheet_directory() . '/includes/myfile.php';
    }
    
    
    

    LG
    Günter

    #890835

    hm ? i tried it but only :

    add_filter( 'avf_register_custom_backend_styles', 'my_include', 10, 1 );
    function my_include(){
    	$path = get_stylesheet_directory().'/includes/register-backend-advanced-styles.php';
        	return $path;
    }

    works than for me – in the manner that it does not append it totaly replaces parent file – this will be ok for me. !
    So i made a copy of the original file and uploaded an edited file to child-theme includes folder

    #891102

    Hi,

    I rechecked it on my install – the filter above works fine for me and you only need to update the necessary array elements you need like you posted in https://kriesi.at/support/topic/a-way-to-have-an-own-register-backend-advanced-styles-php-in-child-theme/#post-890771

    As the new file is included, $advanced is in the scope of both files and can be accessed and modified.

    That was the reason why I added an include of a file and not a filter with data structures (see https://kriesi.at/support/topic/a-way-to-have-an-own-register-backend-advanced-styles-php-in-child-theme/#post-890408) to allow more flexibility in altering the values of all three included style files above.

    Best regards,
    Günter

    #891533

    hm don’t know where my fault was. it now works as expected. % – )

    maybe there was a fault by transfering the php-file name manually ;)

    can be closed

    #891786

    Hi Günter,

    Thanks for letting us know, I’ll close the thread for now.

    Best regards,
    Rikard

Viewing 11 posts - 1 through 11 (of 11 total)
  • The topic ‘A way to have an own register-backend-advanced-styles.php in child-theme’ is closed to new replies.