Just remove stuff that's not needed for a frontend

@todo: I might want to introduce a method in the field that only returns the relevant
data for the front-end

@param array $fields
@return array
184532
private function cleanFields(array $fields): array
    {
        foreach ($fields['fields'] as &$field) {
            if (array_key_exists('generator', $field[key($field)])) {
                unset($field[key($field)]['generator']);
            }
        }

        unset($fields['section']);
        return $fields;
    }
163762
protected function getConstraintsFromfields(array $fields)
    {
        $constraints = [];

        foreach ($fields as $field) {
            if ($field->hasForeignConstraint()) {
                $constraints[] = $field->getForeignConstraint();
            }
        }

        return $constraints;
    }
635212
protected function getMetaboxRules(array $fields)
    {
        $rules = [];

        foreach ($fields as $field) {
            /** @var FieldTypeInterface $field */
            $rules[$field->getName()] = $field->getOption('rules');
        }

        return $rules;
    }
544018
public static function fields($fields) {

        $arr = array();
        if ( is_string($fields) ) {
            $fields = explode(',', $fields);
        }
        foreach ( $fields as $key => $value ) {
            $arr[trim($value)] = 1;
        }
        return $arr;
    }
915269
private function prepareFields(array $fields)
    {
        $preparedFields = [];

        foreach ($fields as $field) {
            $preparedFields[$field->getName()] = $field;
        }

        return $preparedFields;
    }
1003111
public static function rows(array $fields): Rows
    {
        return new class($fields) extends Rows {
            /**
             * @var array
             */
            private $fields;

            /**
             *  constructor.
             *
             * @param array $fields
             */
            public function __construct(array $fields)
            {
                $this->fields = $fields;
            }

            /**
             * @return array
             */
            public function fields(): array
            {
                return $this->fields;
            }
        };
    }
1002272
public function setFields(array $fields)
    {
        $this->clearFields();

        foreach ($fields as $field) {
            $this->addField($field);
        }

        return $this;
    }
185604
protected function dropColumns(array $fields)
    {
        $schema = [];

        foreach($fields as $field)
        {
            $schema[] = $this->dropColumn($field);
        }

        return $schema;
    }
259872
private static function getFieldTypeArray($fields)
    {
        if (count($fields) === 0) {
            return;
        }

        $types = array();

        foreach ($fields as &$field) {
            $types[] = $field->type;
        }

        return $types;
    }
960201
public static function only($data, array $fields)
    {
        if (is_array($data)) {
            return array_intersect_key($data, array_flip($fields));
        } elseif (is_object($data)) {
            $keeps = array_keys(array_diff_key(get_object_vars($data), array_flip($fields)));

            foreach ($keeps as $key) {
                if (property_exists($data, $key)) {
                    unset($data->$key);
                }
            }

            return $data;
        }

        throw new \InvalidArgumentException('Argument 1 not array or object');
    }
1212972
public function setFieldsFromArray(Array $fields) {
    foreach ($fields as $field => $value) {
      $this->set($field, $value);
    }
    return $this;
  }
233225
public function fields($fields = [])
    {
        $this->builder->select([]);
        $this->casts = [];

        if (empty($fields)) {
            foreach ($this->model->fields() as $field) {
                $this->assignField($field);
            }

            return $this;
        }

        foreach ($fields as $field) {
            $this->assignField($this->model->field($field));
        }

        return $this;
    }
148276
protected function fieldsToConfig(array $fields)
    {
        $config = [];
        foreach ($fields as $field) {
            $config[$field['name']] = $field['default'];
        }

        return $config;
    }
152637
public function addFields($fields)
    {
        if (!is_array($fields)) {
            $fields = array_map(function ($f) {
                return trim($f);
            }, explode(',', $fields));
        }

        $this->fields = array_merge($this->fields, $fields);

        return $this;
    }
1057696
protected function getFieldsToDisplay(array $fields = null)
    {
        if (!empty($fields)) {
            return array_filter($this->fields, function ($field) use ($fields) {
                return in_array($field->name, $fields);
            });
        }

        return $this->fields;
    }
448435
protected function getRequiredRelationCollections(array $fields)
    {
        $variables = [];

        $collections = $this->getRelationCollections($fields, 'form');

        foreach ($collections as $collection) {
            $accesor = $this->getRelationAccessor($collection);

            if (!in_array($accesor, $variables)) {
                $variables[] = $accesor;
            }
        }

        return implode(PHP_EOL, $variables);
    }
1062067
public function addMetaField(array $fields)
    {
        $fields = parent::addMetaField($fields);
        foreach ($fields as $key => &$field) {
            if ($field['type'] === 'fieldset') {
                $field['fields'][static::Meta] = $fields[static::Meta];
                unset($fields[static::Meta]);
                break;
            }
        }
        return $fields;
    }