public function renderFields()
    {
        // Save fields in DB
        $this->saveFields();

        // Get contents
        $pageCurrent = $this->currentPage;
        $sectionCurrent = $this->currentSection;
        $formFields = $this->fields;
        $contentOptions = $this->options;

        // Get links
        $u_link = 'page='.$pageCurrent;
        $u_section = !empty($sectionCurrent) ? '&section='.$sectionCurrent : '';

        // Work on vars
        $vars = [
            'title'         => $contentOptions['title'],
            'description'   => $contentOptions['description'],
            'submit'        => $contentOptions['submit'],

            // Texts and URLs
            't_submit'      => Translate::t('adminpage.submit'),
            'u_link'        => $u_link,
            'u_action'      => admin_url('admin.php?'.$u_link.$u_section),
        ];

        // Display sections
        if (!empty($contentOptions['sections']) && is_array($contentOptions['sections'])) {
            foreach ($contentOptions['sections'] as $slug => $opts) {
                // Update option
                $opts['slug'] = $slug;
                $opts['u_link'] = admin_url('admin.php?'.$u_link.'&section='.$slug);

                // Update vars
                $vars['sections'][] = $opts;

                if ($slug !== $sectionCurrent) {
                    continue;
                }

                // Update vars
                $vars['submit'] = $opts['submit'];
            }
        }

        // Work on current vars
        $vars['c_page'] = $pageCurrent;
        $vars['c_section'] = $sectionCurrent;

        // Display fields
        if (!empty($formFields)) {
            foreach ($formFields as $field) {
                if (!$field) {
                    continue;
                }

                $vars['fields'][] = $field->render([], [
                    'template' => 'adminpage',
                ], false);
            }
        }

        // Render view
        Render::view('adminpage.html.twig', $vars, 'adminpage');
    }
public function renderFields()
    {
        // Save fields in DB
        $this->saveFields();

        // Get contents
        $pageCurrent = $this->currentPage;
        $sectionCurrent = $this->currentSection;
        $formFields = $this->fields;
        $contentOptions = $this->options;

        // Get links
        $u_link = 'page='.$pageCurrent;
        $u_section = !empty($sectionCurrent) ? '&section='.$sectionCurrent : '';

        // Work on vars
        $vars = [
            'title'         => $contentOptions['title'],
            'description'   => $contentOptions['description'],
            'submit'        => $contentOptions['submit'],

            // Texts and URLs
            't_submit'      => Translate::t('adminpage.submit'),
            'u_link'        => $u_link,
            'u_action'      => admin_url('admin.php?'.$u_link.$u_section),
        ];

        // Display sections
        if (!empty($contentOptions['sections']) && is_array($contentOptions['sections'])) {
            foreach ($contentOptions['sections'] as $slug => $opts) {
                // Update option
                $opts['slug'] = $slug;
                $opts['u_link'] = admin_url('admin.php?'.$u_link.'&section='.$slug);

                // Update vars
                $vars['sections'][] = $opts;

                if ($slug !== $sectionCurrent) {
                    continue;
                }

                // Update vars
                $vars['submit'] = $opts['submit'];
            }
        }

        // Work on current vars
        $vars['c_page'] = $pageCurrent;
        $vars['c_section'] = $sectionCurrent;

        // Display fields
        if (!empty($formFields)) {
            foreach ($formFields as $field) {
                if (!$field) {
                    continue;
                }

                $vars['fields'][] = $field->render([], [
                    'template' => 'adminpage',
                ], false);
            }
        }

        // Render view
        Render::view('adminpage.html.twig', $vars, 'adminpage');
    }
public function renderFields ( ) { // Save fields in DB $ this -> saveFields ( ) ; // Get contents $ pageCurrent = $ this -> currentPage ; $ sectionCurrent = $ this -> currentSection ; $ formFields = $ this -> fields ; $ contentOptions = $ this -> options ; // Get links $ u_link = 'page=' . $ pageCurrent ; $ u_section = ! empty ( $ sectionCurrent ) ? '&section=' . $ sectionCurrent : '' ; // Work on vars $ vars = [ 'title' => $ contentOptions [ 'title' ] , 'description' => $ contentOptions [ 'description' ] , 'submit' => $ contentOptions [ 'submit' ] , // Texts and URLs 't_submit' => Translate :: t ( 'adminpage.submit' ) , 'u_link' => $ u_link , 'u_action' => admin_url ( 'admin.php?' . $ u_link . $ u_section ) , ] ; // Display sections if ( ! empty ( $ contentOptions [ 'sections' ] ) && is_array ( $ contentOptions [ 'sections' ] ) ) { foreach ( $ contentOptions [ 'sections' ] as $ slug => $ opts ) { // Update option $ opts [ 'slug' ] = $ slug ; $ opts [ 'u_link' ] = admin_url ( 'admin.php?' . $ u_link . '&section=' . $ slug ) ; // Update vars $ vars [ 'sections' ] [ ] = $ opts ; if ( $ slug !== $ sectionCurrent ) { continue ; } // Update vars $ vars [ 'submit' ] = $ opts [ 'submit' ] ; } } // Work on current vars $ vars [ 'c_page' ] = $ pageCurrent ; $ vars [ 'c_section' ] = $ sectionCurrent ; // Display fields if ( ! empty ( $ formFields ) ) { foreach ( $ formFields as $ field ) { if ( ! $ field ) { continue ; } $ vars [ 'fields' ] [ ] = $ field -> render ( [ ] , [ 'template' => 'adminpage' , ] , false ) ; } } // Render view Render :: view ( 'adminpage.html.twig' , $ vars , 'adminpage' ) ; }
Get section fields.
Get section fields .