/**
  * If GridList also has another way to provide mode, then set the field to that mode if it is set and don't
  * let it change.
  */
 public function cmsFields()
 {
     $fields = parent::cmsFields();
     // has the mode been provided some other way?
     $data = [];
     $source = get_class($this);
     if ($otherWays = array_filter($this()->extend('provideGridListTemplateData', $data, $source))) {
         foreach ($otherWays as $otherWay) {
             if (isset($otherWay['Mode'])) {
                 // replace the field with a read-only field set to the first other mode found
                 $fields[static::SingleFieldName] = new \ReadonlyField(static::SingleFieldName, null, $otherWay['Mode']);
             }
         }
     }
     return $fields;
 }
 public function cmsFields()
 {
     return array_merge(parent::cmsFields(), [static::SingleFieldName => new \OptionsetField(static::SingleFieldName, '', $this->config()->get('length_map'), $this()->{static::SingleFieldName} ?: $this->defaultPageLength())]);
 }