Code Duplication    Length = 13-13 lines in 2 locations

main/inc/lib/extra_field_option.lib.php 1 location

@@ 662-674 (lines=13) @@
659
        $form->addElement('hidden', 'type', $this->type);
660
        $form->addElement('hidden', 'field_id', $this->field_id);
661
662
        if ($action == 'edit') {
663
            $translateUrl = api_get_path(WEB_CODE_PATH) . 'extrafield/translate.php?' . http_build_query([
664
                'extra_field_option' => $id
665
            ]);
666
            $translateButton = Display::toolbarButton(get_lang('TranslateThisTerm'), $translateUrl, 'language', 'link');
667
668
            $form->addText(
669
                'display_text',
670
                [get_lang('Name'), $translateButton]
671
            );
672
        } else {
673
            $form->addElement('text', 'display_text', get_lang('Name'));
674
        }
675
676
        $form->addElement('text', 'option_value', get_lang('Value'));
677
        $form->addElement('text', 'option_order', get_lang('Order'));

main/inc/lib/extra_field.lib.php 1 location

@@ 1935-1947 (lines=13) @@
1932
1933
        $form->addElement('header', $header);
1934
1935
        if ($action == 'edit') {
1936
            $translateUrl = api_get_path(WEB_CODE_PATH) . 'extrafield/translate.php?' . http_build_query([
1937
                'extra_field' => $id
1938
            ]);
1939
            $translateButton = Display::toolbarButton(get_lang('TranslateThisTerm'), $translateUrl, 'language', 'link');
1940
1941
            $form->addText(
1942
                'display_text',
1943
                [get_lang('Name'), $translateButton]
1944
            );
1945
        } else {
1946
            $form->addElement('text', 'display_text', get_lang('Name'));
1947
        }
1948
1949
        // Field type
1950
        $types = self::get_field_types();