<?php

    if ($do === 'add') { $this->setPageTitle(LANG_CP_FIELD_ADD); }
    if ($do === 'edit') { $this->setPageTitle(LANG_CP_FIELD . ': ' . $field['title']); }

    $this->addBreadcrumb(LANG_GROUPS_FIELDS, $this->href_to(''));

    if ($do=='add'){
        $this->addBreadcrumb(LANG_CP_FIELD_ADD);
    }

    if ($do=='edit'){
        $this->addBreadcrumb($field['title']);
    }

    $this->addToolButton([
        'class' => 'save process-save',
        'title' => LANG_SAVE,
        'href'  => '#',
        'icon'  => 'save'
    ]);

    $this->addToolButton([
        'class' => 'cancel',
        'title' => LANG_CANCEL,
        'href'  => $this->href_to(''),
        'icon'  => 'undo'
    ]);

    $this->renderControllerChild('admin', 'form_field', [
        'fields_options_link' => href_to('admin', 'ctypes', ['fields_options']),
        'ctype_name'          => $ctype['name'],
        'do'                  => $do,
        'errors'              => $errors,
        'form'                => $form,
        'field'               => $field
    ]);
