<commit_before><?php namespace StudioBonito\Security\Controllers;

/**
 * MemberAdmin.
 *
 * @author       <NAME> <<EMAIL>>
 * @copyright    Studio Bonito Ltd.
 */
class MemberAdmin extends \ModelAdmin
{
    /**
     * The current url segment. {@link LeftAndMain::$url_segment}
     *
     * @config
     * @var string
     */
    private static $url_segment = 'members';

    /**
     * The current menu title. {@link LeftAndMain::$menu_title}
     *
     * @config
     * @var string
     */
    private static $menu_title = 'Security';

    /**
     * The menu icon.
     *
     * @config
     * @var string
     */
    private static $menu_icon = 'framework/admin/images/menu-icons/16x16/community.png';

    /**
     * @config
     * @var int
     */
    private static $menu_priority = -1;

    /**
     * List of all managed {@link DataObject}s in this interface. {@link ModelAdmin::$managed_models}
     *
     * @config
     * @var array|string
     */
    private static $managed_models = [
        'Member',
        'Group',
        'PermissionRole',
    ];

    /**
     * List of all {@link DataObject}s which can be imported through a subclass of {@link BulkLoader} (mostly CSV data).
     *
     * @config
     * @var array
     */
    private static $model_importers = [
        'Member' => 'MemberCsvBulkLoader',
        'Group'  => 'GroupCsvBulkLoader',
    ];

    /**
     * @return array
     */
    public function getManagedModels()
    {
        $models = parent::getManagedModels();

        if(isset($models['Member']) && isset($models['Member']['title'])) {
            $models['Member']['title'] = _t('SecurityAdmin.Users', 'Users');
        }

        if(isset($models['Group']) && isset($models['Group']['title'])) {
            $models['Group']['title'] = singleton('Group')->i18n_plural_name();
        }

        if(isset($models['PermissionRole']) && isset($models['PermissionRole']['title'])) {
            $models['PermissionRole']['title'] = _t('SecurityAdmin.TABROLES', 'Roles');
        }

        return $models;
    }
}<commit_msg>ADD: Move Export/Print buttons to after GridField<commit_after><?php namespace StudioBonito\Security\Controllers;

use GridFieldButtonRow;
use GridFieldExportButton;
use GridFieldPrintButton;

/**
 * MemberAdmin.
 *
 * @author       <NAME> <<EMAIL>>
 * @copyright    Studio Bonito Ltd.
 */
class MemberAdmin extends \ModelAdmin
{
    /**
     * The current url segment. {@link LeftAndMain::$url_segment}
     *
     * @config
     * @var string
     */
    private static $url_segment = 'members';

    /**
     * The current menu title. {@link LeftAndMain::$menu_title}
     *
     * @config
     * @var string
     */
    private static $menu_title = 'Security';

    /**
     * The menu icon.
     *
     * @config
     * @var string
     */
    private static $menu_icon = 'framework/admin/images/menu-icons/16x16/community.png';

    /**
     * @config
     * @var int
     */
    private static $menu_priority = -1;

    /**
     * List of all managed {@link DataObject}s in this interface. {@link ModelAdmin::$managed_models}
     *
     * @config
     * @var array|string
     */
    private static $managed_models = [
        'Member',
        'Group',
        'PermissionRole',
    ];

    /**
     * List of all {@link DataObject}s which can be imported through a subclass of {@link BulkLoader} (mostly CSV data).
     *
     * @config
     * @var array
     */
    private static $model_importers = [
        'Member' => 'MemberCsvBulkLoader',
        'Group'  => 'GroupCsvBulkLoader',
    ];

    /**
     * @return array
     */
    public function getManagedModels()
    {
        $models = parent::getManagedModels();

        if(isset($models['Member']) && isset($models['Member']['title'])) {
            $models['Member']['title'] = _t('SecurityAdmin.Users', 'Users');
        }

        if(isset($models['Group']) && isset($models['Group']['title'])) {
            $models['Group']['title'] = singleton('Group')->i18n_plural_name();
        }

        if(isset($models['PermissionRole']) && isset($models['PermissionRole']['title'])) {
            $models['PermissionRole']['title'] = _t('SecurityAdmin.TABROLES', 'Roles');
        }

        return $models;
    }

    /**
     * @param null $id
     * @param null $fields
     *
     * @return \CMSForm
     */
    public function getEditForm($id = null, $fields = null)
    {
        $form = parent::getEditForm($id, $fields);

        $gridField = $form->Fields()->dataFieldByName($this->sanitiseClassName($this->modelClass));
        $gridFieldConfig = $gridField->getConfig();

        $gridFieldConfig->addComponent(new GridFieldButtonRow('after'));

        $gridFieldConfig->removeComponentsByType('GridFieldExportButton');

        $exportButton = new GridFieldExportButton('buttons-after-left');
        $exportButton->setExportColumns($this->getExportFields());

        $gridFieldConfig->addComponent($exportButton);

        $gridFieldConfig->removeComponentsByType('GridFieldPrintButton');

        $gridFieldConfig->addComponent(new GridFieldPrintButton('buttons-after-left'));

        return $form;
    }
}
{'fraction_non_alphanumeric': 0.15640727835849788, 'fraction_numerical': 0.0027100271002710027, 'mean_word_length': 2.5149659863945577, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4716119', 'n_tokens_mistral': 1530, 'n_tokens_neox': 1496, 'n_words': 304}