• Resolved yst14

    (@yst14)


    Hi,

    I am using WP 4.6.1 and APF 3.8.4.

    I am trying to setup an ACE field to allow my users to enter HTML/CSS/JS/PHP into a field however when using the field type ace no field shows up however the title and description do.

    Would you be able to offer some guidance please.

    Site Status:
    https://gist.github.com/BHWD/1c2036ffa50bb7c3690821c38e12ef30

    Code used:

     public function load_dat_settings_dat_custom_template( $oAdminPage ) {
            
            $this->addSettingFields(
                array(    // Ace
                    'field_id'      => 'dat_custom_template_html',
                    'type'          => 'ace',
                    'title'         => 'Custom Template code',
                    'description'   => 'Please enter your custom template code here. You are able to use the following shortcodes within your content to retrive the testiomonial data. A sample template can be found in the file <code>sample-custom-template.php</code>',   
                ),
    array( // Submit button
                    'field_id'      => 'ct_submit_button',
                    'type'          => 'submit',
                    'value'		=> 'Update Custom Template',
                )   
            );         
            
        }
    • This topic was modified 8 years, 2 months ago by yst14.
Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author miunosoft

    (@miunosoft)

    Hi,

    Probably you haven’t instantiated the field type class to register it for the class.

    Try adding the load() method in your class if there isn’t. And instantiate the field type class by passing the class name which extends a framework factory class.

    
        public function load() {
       
            new  NoouDAT_AceCustomFieldType( $this->oProp->sClassName );
       
        }
    

    Hope this helps.

    • This reply was modified 8 years, 2 months ago by miunosoft.
    Thread Starter yst14

    (@yst14)

    Hey,

    I have tried this but it hasn’t worked. Please find my complete code here:

    https://gist.github.com/BHWD/b7356598de48602c393f26de48269944

    Thanks
    Ben

    Plugin Author miunosoft

    (@miunosoft)

    Hi,

    You have the line,

    
    'section_id'        => 'a_section',
    

    If you specify a section, you must add a section first. Try adding a section with the set section ID or just comment out the line. To add a section use the addFormSections() method.

    
            $this->addSettingSections(
                array(
                    'section_id'   => 'a_section',
                    'title'        => 'Section A',
                    'description'  => 'This is a section description.',
                )
            );
    

    Hope this helps.

    Thread Starter yst14

    (@yst14)

    Ahh yes! I missed that bit! Thank you. Is it possible to define more than 1 language?

    Plugin Author miunosoft

    (@miunosoft)

    Glad to hear it works.

    As for the field type specifications, you should ask the developer who wrote it or the one who maintains the ACE library.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘ACE custom field not working’ is closed to new replies.