Return the page pick wizard for the editor_helpurl
@param DataContainer $dc
540037
public function pickUrl(DataContainer $dc)
    {
        return ' <a href="contao/page.php?do='.Input::get('do').'&amp;table='.$dc->table.'&amp;field='.$dc->field.'&amp;value='.str_replace(array('{{link_url::', '}}'), '', $dc->value).'" title="'.specialchars($GLOBALS['TL_LANG']['MSC']['pagepicker']).'" onclick="Backend.getScrollOffset();Backend.openModalSelector({\'width\':765,\'title\':\''.specialchars(str_replace("'", "\\'", $GLOBALS['TL_LANG']['MOD']['page'][0])).'\',\'url\':this.href,\'id\':\''.$dc->field.'\',\'tag\':\'ctrl_'.$dc->field . ((Input::get('act') == 'editAll') ? '_' . $dc->id : '').'\',\'self\':this});return false">' . $this->generateImage('pickpage.gif', $GLOBALS['TL_LANG']['MSC']['pagepicker'], 'style="vertical-align:top;cursor:pointer"') . '</a>';
    }
779812
public function edit($id)
    {
        try
        {
            $group = $this->groups->findById($id);

            $groupPermissions = $group->getPermissions();
            $genericPermissions = $this->permissions->generic();
            $modulePermissions = $this->permissions->module();


            return View::make(Config::get('cpanel::views.groups_edit'))
                ->with('group',$group)
                ->with('genericPermissions',$genericPermissions)
                ->with('modulePermissions',$modulePermissions)
                ->with('groupPermissions',$groupPermissions);
        }
        catch ( GroupNotFoundException $e)
        {
            return Redirect::route('admin.groups.index')->with('error', $e->getMessage());
        }
    }
975500
public function setArticlesRows($dc)
	{
		$element = \ContentModel::findByPk($dc->id);

		$GLOBALS['TL_DCA']['tl_content']['fields']['bootstrap_columnset']['eval']['minCount'] = $element->sc_type;
	}
1091479
public function getBackButton()
    {
        $container = $GLOBALS['container'];

        $dataContainer  = $container['dc-general.data-definition-container'];
        $dataDefinition = $dataContainer->getDefinition($this->table);

        $environment = new DefaultEnvironment();
        $environment->setDataDefinition($dataDefinition);
        $environment->setTranslator($container['translator']);
        $environment->setEventDispatcher($container['event-dispatcher']);
        $environment->setInputProvider(new InputProvider());
        $environment->setClipboard(new Clipboard());

        $renderer = new GlobalButtonRenderer($environment);
        return $renderer->render();
    }
332804
public function dispatchAjaxRequest($strAction, \DataContainer $dc)
    {
        switch ($strAction) {
            // Upload the file
            /** @noinspection PhpMissingBreakStatementInspection */
            case 'fineuploader_upload':
                $arrData['strTable'] = $dc->table;
                $arrData['id'] = $dc->id; // @todo what was $this->strAjaxName for?
                $arrData['name'] = \Input::post('name');

                /** @var FineUploaderWidget $objWidget */
                $objWidget = new $GLOBALS['BE_FFL']['fineUploader']($arrData, $dc);
                $strFile = $objWidget->validateUpload();

                if ($objWidget->hasErrors()) {
                    $arrResponse = array('success' => false, 'error' => $objWidget->getErrorAsString(), 'preventRetry' => true);
                } else {
                    $arrResponse = array('success' => true, 'file' => $strFile);
                }

                $response = new \Haste\Http\Response\JsonResponse($arrResponse);
                $response->send();
            // no break, response exits script

            // Reload the widget
            case 'fineuploader_reload':
                $intId = \Input::get('id');
                $strField = $dc->field = \Input::post('name');

                // Handle the keys in "edit multiple" mode
                if (\Input::get('act') == 'editAll') {
                    $intId = preg_replace('/.*_([0-9a-zA-Z]+)$/', '$1', $strField);
                    $strField = preg_replace('/(.*)_[0-9a-zA-Z]+$/', '$1', $strField);
                }

                // The field does not exist
                if (!isset($GLOBALS['TL_DCA'][$dc->table]['fields'][$strField])) {
                    System::log('Field "' . $strField . '" does not exist in DCA "' . $dc->table . '"', __METHOD__, TL_ERROR);
                    header('HTTP/1.1 400 Bad Request');
                    die('Bad Request');
                }

                $objRow = null;
                $varValue = null;

                // Load the value
                if ($GLOBALS['TL_DCA'][$dc->table]['config']['dataContainer'] == 'File') {
                    $varValue = $GLOBALS['TL_CONFIG'][$strField];
                } elseif ($intId > 0 && Database::getInstance()->tableExists($dc->table)) {
                    $objRow = Database::getInstance()->prepare("SELECT * FROM " . $dc->table . " WHERE id=?")
                        ->execute($intId);

                    // The record does not exist
                    if ($objRow->numRows < 1) {
                        System::log('A record with the ID "' . $intId . '" does not exist in table "' . $dc->table . '"', __METHOD__, TL_ERROR);
                        header('HTTP/1.1 400 Bad Request');
                        die('Bad Request');
                    }

                    $varValue = $objRow->$strField;
                    $dc->activeRecord = $objRow;
                }

                // Call the load_callback
                if (is_array($GLOBALS['TL_DCA'][$dc->table]['fields'][$strField]['load_callback'])) {
                    foreach ($GLOBALS['TL_DCA'][$dc->table]['fields'][$strField]['load_callback'] as $callback) {
                        if (is_array($callback)) {
                            $varValue = System::importStatic($callback[0])->{$callback[1]}($varValue, $dc);
                        } elseif (is_callable($callback)) {
                            $varValue = $callback($varValue, $dc);
                        }
                    }
                }

                $varValue = \Input::post('value', true);

                // Convert the selected values
                if ($varValue != '') {
                    $varValue = trimsplit(',', $varValue);

                    foreach ($varValue as $k => $v) {
                        if (\Validator::isUuid($v) && !is_file(TL_ROOT . '/' . $v)) {
                            $varValue[$k] = \StringUtil::uuidToBin($v);
                        }
                    }

                    $varValue = serialize($varValue);
                }

                // Build the attributes based on the "eval" array
                $arrAttribs = $GLOBALS['TL_DCA'][$dc->table]['fields'][$strField]['eval'];

                $arrAttribs['id'] = $dc->field;
                $arrAttribs['name'] = $dc->field;
                $arrAttribs['value'] = $varValue;
                $arrAttribs['strTable'] = $dc->table;
                $arrAttribs['strField'] = $strField;
                $arrAttribs['activeRecord'] = $dc->activeRecord;

                $objWidget = new $GLOBALS['BE_FFL']['fineUploader']($arrAttribs);
                $response = new \Haste\Http\Response\HtmlResponse($objWidget->parse());
                $response->send();
        }
    }
972556
public function configureFolderPage($dc)
    {
        if (null === $dc->activeRecord || 'folder' !== $dc->activeRecord->type) {
            return;
        }

        $this->db->update(
            'tl_page',
            [
                'alias' => '',
                'noSearch' => '1',
                'sitemap' => 'map_never',
                'published' => '1',
                'start' => '',
                'stop' => '',
            ],
            [
                'id' => $dc->id,
            ]
        );
    }
109087
public function fetchButton($type = 'Help', $url = '#', $width = 700, $height = 500)
	{
		$text  = \Lang::txt('JTOOLBAR_HELP');
		$class = $this->fetchIconClass('help');
		$msg   = \Lang::txt('JHELP', true);

		if (!strstr('?', $url)
		 && !strstr('&', $url)
		 && substr($url, 0, 4) != 'http')
		{
			$url = \Route::url('index.php?option=com_help&component=' . \Request::getCmd('option') . '&page=' . $url);
		}
		else
		{
			$url = $this->_getCommand($ref = $type, $com = false, $override = false, $component = \Request::getCmd('option'));
		}

		$html  = '<a href="' . $url . '" data-title="' . $text . '" data-message="' . $msg. '" data-width="' . $width . '" data-height="' . $height . '" rel="help" class="toolbar toolbar-popup">' . "\n";
		$html .= '<span class="' . $class . '">' . "\n";
		$html .= $text . "\n";
		$html .= '</span>' . "\n";
		$html .= '</a>' . "\n";

		return $html;
	}
703673
function _get_admin_page_url( $page = '', $params = array(), $network = null ) {
            if ( is_null( $network ) ) {
                $network = (
                    $this->_is_network_active &&
                    ( fs_is_network_admin() || ! $this->is_delegated_connection() )
                );
            }

            if ( 0 < count( $params ) ) {
                foreach ( $params as $k => $v ) {
                    $params[ $k ] = urlencode( $v );
                }
            }

            $page_param = $this->_menu->get_slug( $page );

            if ( empty( $page ) &&
                 $this->is_theme() &&
                 // Show the opt-in as an overlay for free wp.org themes or themes without any settings page.
                 ( $this->is_free_wp_org_theme() || ! $this->has_settings_menu() )
            ) {
                $params[ $this->get_unique_affix() . '_show_optin' ] = 'true';

                return add_query_arg(
                    $params,
                    $this->admin_url( 'themes.php', 'admin', $network )
                );
            }

            if ( ! $this->has_settings_menu() ) {
                if ( ! empty( $page ) ) {
                    // Module doesn't have a setting page, but since the request is for
                    // a specific Freemius page, use the admin.php path.
                    return add_query_arg( array_merge( $params, array(
                        'page' => $page_param,
                    ) ), $this->admin_url( 'admin.php', 'admin', $network ) );
                } else {
                    if ( $this->is_activation_mode() ) {
                        /**
                         * @author Vova Feldman
                         * @since  1.2.1.6
                         *
                         * If plugin doesn't have a settings page, create one for the opt-in screen.
                         */
                        return add_query_arg( array_merge( $params, array(
                            'page' => $this->_slug,
                        ) ), $this->admin_url( 'admin.php', 'admin', $network ) );
                    } else {
                        // Plugin without a settings page.
                        return add_query_arg(
                            $params,
                            $this->admin_url( 'plugins.php', 'admin', $network )
                        );
                    }
                }
            }

            // Module has a submenu settings page.
            if ( ! $this->_menu->is_top_level() ) {
                $parent_slug = $this->_menu->get_parent_slug();
                $menu_file   = ( false !== strpos( $parent_slug, '.php' ) ) ?
                    $parent_slug :
                    'admin.php';

                return add_query_arg( array_merge( $params, array(
                    'page' => $page_param,
                ) ), $this->admin_url( $menu_file, 'admin', $network ) );
            }

            // Module has a top level CPT settings page.
            if ( $this->_menu->is_cpt() ) {
                if ( empty( $page ) && $this->is_activation_mode() ) {
                    return add_query_arg( array_merge( $params, array(
                        'page' => $page_param
                    ) ), $this->admin_url( 'admin.php', 'admin', $network ) );
                } else {
                    if ( ! empty( $page ) ) {
                        $params['page'] = $page_param;
                    }

                    return add_query_arg(
                        $params,
                        $this->admin_url( $this->_menu->get_raw_slug(), 'admin', $network )
                    );
                }
            }

            // Module has a custom top level settings page.
            return add_query_arg( array_merge( $params, array(
                'page' => $page_param,
            ) ), $this->admin_url( 'admin.php', 'admin', $network ) );
        }
880628
def get_edit_handler(self):
        ''''''
        # just a flag
        self.generic = 'false'

        return '''

        <span class="input-group-btn">
            <a href="#" id="item-edit-%(id)s" data-add-to-field="id_file" class="btn btn-default disabled"><span class="fa fa-pencil"></span></a></span>
        <script>

        if ($('*[data-add-item-url="%(url)s"]').val()) {
            $('#item-edit-%(id)s').removeClass('disabled');
        }

        $('*[data-add-item-url="%(url)s"]').on('change', function (e) {
            if ($('*[data-add-item-url="%(url)s"]').val()) {
                $('#item-edit-%(id)s').removeClass('disabled');
            } else {
                $('#item-edit-%(id)s').addClass('disabled');
            }
        });

        $("#item-edit-%(id)s").click(function() {

            var generic = %(generic)s;
            var ajax_opts = {};
            var id = $('*[data-add-item-url="%(url)s"]').val();

            if (generic) {

                ajax_opts = {
                  url: "/widget/js-reverse/",
                  method: 'POST',
                  data: {
                    viewname: '%(update_viewname)s',
                    kwargs:  JSON.stringify({
                        cls_name: '%(cls_name)s',
                        id: id,
                        form_cls: '%(form_cls)s'
                        })
                    }
                };

            } else {
                ajax_opts = {
                  url: "/widget/js-reverse/",
                  method: 'POST',
                  data: {
                    viewname: '%(update_viewname)s',
                    args: JSON.stringify({id: id})
                    }
                };
            }
            $.ajax(ajax_opts)
              .done(function( data ) {

                horizon.modals._request = $.ajax(data.url, {
                  beforeSend: function () {
                    horizon.modals.modal_spinner(gettext("Loading"));
                  },
                  complete: function () {
                    // Clear the global storage;
                    horizon.modals._request = null;
                    horizon.modals.spinner.modal('hide');
                  },
                  error: function(jqXHR, status, errorThrown) {
                    if (jqXHR.status === 401){
                      var redir_url = jqXHR.getResponseHeader("X-Horizon-Location");
                      if (redir_url){
                        location.href = redir_url;
                      } else {
                        location.reload(true);
                      }
                    }
                    else {
                      if (!horizon.ajax.get_messages(jqXHR)) {
                        // Generic error handler. Really generic.
                        horizon.alert("danger", gettext(
                            "An error occurred. Please try again later."));
                      }
                    }
                  },
                  success: function (data, textStatus, jqXHR) {
                    var update_field_id = 'data-add-to-field',
                      modal,
                      form;
                    modal = horizon.modals.success(
                        data, textStatus, jqXHR);
                    if (update_field_id) {
                      form = modal.find("form");
                      if (form.length) {
                        form.attr("data-add-to-field", update_field_id);
                      }
                    }
                  }
                });
              });
        });
        </script>
        ''' % {'update_viewname': self.get_update_view_name(),
               'cls_name': self.get_cls_name(),
               'url': self.get_add_item_url(),
               'form_cls': self.get_form_cls(),
               'id': self.__hash__(),
               'generic': self.generic}
1161792
public function onPanelCallback(DataContainer $dc): string
    {
        /** @var AttributeBagInterface $bag */
        $bag = $this->session->getBag('contao_backend');
        $session = $bag->all();

        $sorting = ['_default', 'total_asc', 'total_desc'];
        $request = $this->requestStack->getCurrentRequest();

        // Store the sorting in the session
        if ('tl_filters' === $request->request->get('FORM_SUBMIT')) {
            $sort = $request->request->get('tl_sort');

            if ('_default' !== $sort && \in_array($sort, $sorting, true)) {
                $session['sorting'][$dc->table] = $sort;
            } else {
                $session['sorting'][$dc->table] = null;
            }

            $bag->replace($session);
        }

        $options = [];

        // Generate the markup options
        foreach ($sorting as $option) {
            $options[] = \sprintf(
                '<option value="%s"%s>%s</option>',
                StringUtil::specialchars($option),
                ($session['sorting'][$dc->table] === $option) ? ' selected="selected"' : '',
                ('_default' === $option) ? $GLOBALS['TL_DCA'][$dc->table]['fields'][$GLOBALS['TL_DCA'][$dc->table]['list']['sorting']['fields'][0]]['label'][0] : $GLOBALS['TL_LANG'][$dc->table]['sortRef'][$option]
            );
        }

        return '

<div class="tl_sorting tl_subpanel">
<strong>'.$GLOBALS['TL_LANG']['MSC']['sortBy'].':</strong>
<select name="tl_sort" id="tl_sort" class="tl_select">
'.\implode("\n", $options).'
</select>
</div>';
    }
784700
public function save($value, $dc)
	{
		// shortcuts
		$start  = ContentWrapper\Model::TYPE_START;
		$stop   = ContentWrapper\Model::TYPE_STOP;
		$sep    = ContentWrapper\Model::TYPE_SEPARATOR;

		// handle issues with contao models
		if(version_compare(VERSION, '3.2', '>=')) {
			try {
				$model = new \ContentModel($dc->activeRecord);
			}
			catch(\Exception $e) {
				$model = \ContentModel::findByPk($dc->id);
			}
		}
		else {
			$model = new \ContentModel($dc->activeRecord);
		}

		$model->type = $value;

		$this->objModel = new ContentWrapper\Model($model);
		$sorting = $this->objModel->sorting;

		// getType will throw an exception if type is not found. use it to detect non content wrapper elements
		try {
			$type = $this->objModel->getType();
		}
		catch(\Exception $e)
		{
			return $value;
		}

		// check for existing parent element and try to create it if not existing
		if($type != $start) {
			if($this->objModel->bootstrap_parentId == '') {
				$parent = ContentWrapper\Repository::findPreviousElement($this->objModel, $start);

				if($parent) {
					// set relation to parent element
					$this->objModel->bootstrap_parentId = $parent->id;

					$end = ContentWrapper\Repository::findRelatedElement($this->objModel, $stop);

					if($end === null) {
						$this->objModel->sorting = $parent->sorting + 2;
					}
					elseif($parent !== null && $parent->sorting > $end->sorting) {
						$this->objModel->sorting = $end->sorting - 2;
					}

					// set relation to parent element
					if($this->objModel->getType() != $start) {
						$this->objModel->bootstrap_parentId = $parent->id;
					}

					$this->objModel->getModel()->save();
				}

				// create parent if possible
				elseif($this->isTrigger($type, $start)) {
					$sorting = $sorting-2;
					$this->createElement($sorting, $start);
				}

				// no parent element exists, throw error
				else
				{
					throw new \Exception(sprintf(
						$GLOBALS['TL_LANG']['ERR']['wrapperStartNotExists'],
						$GLOBALS['TL_LANG']['CTE'][$value][0] ?: $value
					));
				}
			}
		}

		// create separators if possible
		if($type != $sep && ($this->isTrigger($type, $sep) || $this->isTrigger($type, $sep, static::TRIGGER_DELETE)))
		{
			$config   = $GLOBALS['BOOTSTRAP']['wrappers'][$this->objModel->getGroup()][$sep];
			$callback = $config['countExisting'];
			$this->import($callback[0]);
			$existing = $this->$callback[0]->$callback[1]($this->objModel);

			$callback = $config['countRequired'];
			$this->import($callback[0]);
			$required = $this->$callback[0]->$callback[1]($this->objModel);

			if($existing < $required)
			{
				if($this->isTrigger($type, $sep))
				{
					$count = $required - $existing;

					for($i = 0; $i < $count; $i++)
					{
						$this->createElement($sorting, $sep);
					}

					$end = ContentWrapper\Repository::findRelatedElement($this->objModel, $stop);

					if($end && $end->sorting <= $sorting) {
						$sorting = $sorting + 2;
						$end->sorting = $sorting;
						$end->save();
					}
				}
			}
			elseif($required < $existing)
			{
				if($this->isTrigger($type, $sep, static::TRIGGER_DELETE))
				{
					$count = $existing - $required;

					$parentId = $this->objModel->getType() == ContentWrapper\Model::TYPE_START
						? $this->objModel->id
						: $this->objModel->bootstrap_parentId;

					$this->Database
						->prepare('DELETE FROM tl_content WHERE bootstrap_parentId=? AND type=? ORDER BY sorting DESC')
						->limit($count)
						->execute($parentId, $this->objModel->getTypeName($sep));
				}
			}
		}

		// cereate end element
		if($type == $start && $this->isTrigger($type, $stop))
		{
			$end = ContentWrapper\Repository::countRelatedElements($this->objModel, $stop);

			if(!$end) {
				$end = $this->createElement($sorting, $stop);
			}
		}

		return $value;
	}
379354
public function addBreadcrumb(\DataContainer $dc)
  {
    // Set a new cat
    if (isset($_GET['cat']))
    {
      $this->Session->set('tl_category_id', $this->Input->get('cat'));
      $this->redirect(preg_replace('/&cat=[^&]*/', '', $this->Environment->request));
    }

    $intCategoryId = $this->Session->get('tl_category_id');

    if ($intCategoryId < 1)
    {
      return;
    }

    $arrIds = array();
    $arrLinks = array();

    // Generate breadcrumb trail
    $category = $this->getCategoryForId($intCategoryId, true, false);

    if ($category == null)
    {
      $this->Session->set('tl_category_id', 0);
      return;
    }

    // Add root link
    $arrLinks[] = '<img src="system/modules/DocumentManagementSystem/assets/dms.png" width="16" height="16" alt=""> <a href="' . $this->addToUrl('cat=0') . '">' . $GLOBALS['TL_LANG']['MSC']['filterAll'] . '</a>';
    foreach ($category->getPath(false) as $eachCategory)
    {
      $image = 'category.png';
      if (!$eachCategory->isPublished())
      {
        $image = 'category_1.png';
      }
      if ($eachCategory->id == $intCategoryId)
      {
        $arrLinks[] = $this->generateImage('system/modules/DocumentManagementSystem/assets/' . $image, '', "") . ' ' . $eachCategory->name;
      }
      else
      {
        $arrLinks[] = $this->generateImage('system/modules/DocumentManagementSystem/assets/' . $image, '', "") . ' <a href="' . $this->addToUrl('cat='.$eachCategory->id) . '">' . $eachCategory->name . '</a>';
      }
    }

    // Limit tree
    $GLOBALS['TL_DCA']['tl_dms_categories']['list']['sorting']['root'] = array($intCategoryId);

    // Insert breadcrumb menu
    $GLOBALS['TL_DCA']['tl_dms_categories']['list']['sorting']['breadcrumb'] .= '

<ul id="tl_breadcrumb">
  <li>' . implode(' &gt; </li><li>', $arrLinks) . '</li>
</ul>';
  }
1155461
public function getRenderedEditor($id, array $options = array())
    {
        $config = clone $this->options;
        $config->setFromArray($options);
        
        $basePath = $this->getView()->basePath($config->getBasePath());
        $editor = new \CKEditor($basePath);
        
        return $editor->replace($id, $this->optionsToCKEditorConfig($config));
    }
2978
public function _getDatafieldRenderer()
    {
        $this->datafieldRenderer = $this->getLayout()->createBlock(
            \Dotdigitalgroup\Email\Block\Adminhtml\Config\Select::class,
            '',
            ['data' => ['is_render_to_js_template' => true]]
        );

        return $this->datafieldRenderer;
    }
321747
public function onSubmitCallback(DataContainer $dc)
    {
        // Schedule a news feed update
        if ('tl_news_category' === $dc->table && $dc->id) {
            /** @var Model $modelAdapter */
            $modelAdapter = $this->framework->getAdapter(Model::class);

            $newsIds = $modelAdapter->getReferenceValues('tl_news', 'categories', $dc->id);
            $newsIds = \array_map('intval', \array_unique($newsIds));

            if (\count($newsIds) > 0) {
                $archiveIds = $this->db
                    ->executeQuery('SELECT DISTINCT(pid) FROM tl_news WHERE id IN ('.\implode(',', $newsIds).')')
                    ->fetchAll(\PDO::FETCH_COLUMN, 0);

                $session = $this->session->get('news_feed_updater');
                $session = \array_merge((array) $session, $archiveIds);
                $this->session->set('news_feed_updater', \array_unique($session));
            }
        }
    }
554012
public function edit($content)
    {
        $parent = BlockSelectOption::where('block_id', '=', $this->_block->id)->where('option', '=', 'parent')->first();
        $parentPageId = !empty($parent) ? $parent->value : 0;
        $this->_editViewData['selectOptions'] = [0 => '-- No Page Selected --'] + Page::get_page_list(['parent' => $parentPageId]);
        return parent::edit($content);
    }
479688
public function getFieldEditorGrid()
    {
        Requirements::javascript('silverstripe/userforms:client/dist/js/userforms-cms.js');

        $fields = $this->owner->Fields();

        $this->createInitialFormStep(true);

        $editableColumns = new GridFieldEditableColumns();
        $fieldClasses = singleton(EditableFormField::class)->getEditableFieldClasses();
        $editableColumns->setDisplayFields([
            'ClassName' => function ($record, $column, $grid) use ($fieldClasses) {
                if ($record instanceof EditableFormField) {
                    return $record->getInlineClassnameField($column, $fieldClasses);
                }
            },
            'Title' => function ($record, $column, $grid) {
                if ($record instanceof EditableFormField) {
                    return $record->getInlineTitleField($column);
                }
            }
        ]);

        $config = GridFieldConfig::create()
            ->addComponents(
                $editableColumns,
                new GridFieldButtonRow(),
                (new GridFieldAddClassesButton(EditableTextField::class))
                    ->setButtonName(_t(__CLASS__.'.ADD_FIELD', 'Add Field'))
                    ->setButtonClass('btn-primary'),
                (new GridFieldAddClassesButton(EditableFormStep::class))
                    ->setButtonName(_t(__CLASS__.'.ADD_PAGE_BREAK', 'Add Page Break'))
                    ->setButtonClass('btn-secondary'),
                (new GridFieldAddClassesButton([EditableFieldGroup::class, EditableFieldGroupEnd::class]))
                    ->setButtonName(_t(__CLASS__.'.ADD_FIELD_GROUP', 'Add Field Group'))
                    ->setButtonClass('btn-secondary'),
                $editButton = new GridFieldEditButton(),
                new GridFieldDeleteAction(),
                new GridFieldToolbarHeader(),
                new GridFieldOrderableRows('Sort'),
                new GridFieldDetailForm()
            );

        $editButton->removeExtraClass('grid-field__icon-action--hidden-on-hover');

        $fieldEditor = GridField::create(
            'Fields',
            '',
            $fields,
            $config
        )->addExtraClass('uf-field-editor');

        return $fieldEditor;
    }