Returns slug fields

@param string|false $primary

@return array
515565
public function getSlugableFieldNames($primary = false)
    {
        $results = [];
        if ($primary) {
            $results[] = $primary;
        }

        if (!isset($this->data['fields']) || empty($this->data['fields'])) {
            return $results;
        }

        $table = $this->data['name'];
        foreach ($this->data['fields'] as $field) {
            $name = $table . '_' . $field['name'];
            if (isset($field['type'])) {
                if ($field['type'] === 'slug') {
                    $results[] = $name;
                }
            }
        }

        return $results;
    }
750509
public function getSpecialFields()
    {
        $cached = $this->cache['special_fields'] ?? null;
        if ($cached !== null) {
            return $cached;
        }

        $model = $this->model_class;
        $special = [
            'PRIMARY_KEY' => $model::PRIMARY_KEY,
            'AUTO_INCREMENT' => (array) $model::AUTO_INCREMENT,
            'STAMP_COLUMNS' => $model::STAMP_COLUMNS,
            'OPTIONAL_COLUMNS' => $model::OPTIONAL_COLUMNS,
            'FOREIGN_KEYS' => array_keys($model::FOREIGN_KEYS),
            'SOFT_DELETE' => (array) $model::SOFT_DELETE,
        ];

        $this->cache['special_fields'] = $special;
        return $special;
    }
1049338
private function getExistingSlugs($slug)
    {
        $list = collect();
        foreach ($this->uniqueModels() as $class) {

            // get entries matching slug
            $slugs = $this->eloqent($class)
                ->whereRaw("slug LIKE '$slug%'")
                ->withTrashed()// trashed, when entry gets activated
                ->get()
                ->pluck('slug');

            $list = $list->merge($slugs);
        }

        return $list;
    }
816067
public static function getExtFromType($type, $primary = false) {
        $exts = array();

        foreach (self::$_types as $ext => $mimeType) {
            $isPrimary = false;

            if (is_array($mimeType)) {
                $mimeType = $mimeType[0];
                $isPrimary = $mimeType[1];
            }

            if ($mimeType == $type) {
                if ($primary && $isPrimary) {
                    return $ext;
                }

                $exts[] = $ext;
            }
        }

        if ($primary && isset($exts[0])) {
            return $exts[0];
        }

        return $exts;
    }
431247
public function getRawValue(): array
	{
		$primaryValues = [];
		foreach ($this->getIterator() as $entity) {
			if ($entity->isPersisted()) {
				$primaryValues[] = $entity->getValue('id');
			}
		}
		return $primaryValues;
	}
784259
protected function fetchPrimaryKeys(): array
    {
        $query = "SHOW INDEXES FROM {$this->driver->identifier($this->getName())}";

        $primaryKeys = [];
        foreach ($this->driver->query($query) as $index) {
            if ($index['Key_name'] == 'PRIMARY') {
                $primaryKeys[] = $index['Column_name'];
            }
        }

        return $primaryKeys;
    }
118006
public function getPrimaryKeys(): array
    {
        $primaryColumns = [];
        foreach ($this->getColumns() as $column) {
            if ($column->getAbstractType() == 'primary' || $column->getAbstractType() == 'bigPrimary') {
                if (!in_array($column->getName(), $this->primaryKeys)) {
                    //Only columns not listed as primary keys already
                    $primaryColumns[] = $column->getName();
                }
            }
        }

        return array_unique(array_merge($this->primaryKeys, $primaryColumns));
    }
713847
public function getExistingSlugs($slug)
    {
        return self::select('slug')->where('slug', 'like', $slug.'%')
            ->when($this->id, function ($query) {
                return $query->where('id', '<>', $this->id);
            })
            ->get();
    }
743039
protected function getAdditionalFields()
    {
        $additionalFields = [];

        foreach ($this->additionalFieldNames as $additionalFieldName) {
            $additionalFields[$additionalFieldName] = $this->getFieldValue($additionalFieldName);
        }

        return $additionalFields;
    }
1224175
public function primaryKey()
    {
        $primaryKeys = [];
        foreach ($this->_columns as $name => $data) {
            if ((!array_key_exists('primaryKey', $data)) || ($data['primaryKey'] !== true)) {
                continue;
            }

            $primaryKeys[] = $name;
        }

        return $primaryKeys;
    }
662871
public function fields(): array
    {
        return [
            Input::make('role.name')
                ->type('text')
                ->max(255)
                ->required()
                ->title(__('Name'))
                ->placeholder(__('Name'))
                ->help(__('User role display name')),

            Input::make('role.slug')
                ->type('text')
                ->max(255)
                ->required()
                ->title(__('Slug'))
                ->placeholder(__('Slug'))
                ->help(__('Actual name in the system')),
        ];
    }
148364
private static function get_all_fields( $target_id = 0 ) {
		$data = [];

		$field_objs = get_field_objects( $target_id );

		if ( $field_objs ) {
			foreach ( $field_objs as $field_name => $field_obj ) {
				$value = self::get_single_field( $target_id, $field_obj );

				$group_slug = self::get_group_slug( $field_obj['parent'] );

				if ( $group_slug ) {
					$data[ $group_slug ][ $field_name ] = $value;
				} else {
					$data[ $field_name ] = $value;
				}
			}
		}

		return $data;
	}
1018943
public function getCMSFields()
    {
        $fields = parent::getCMSFields();

        $bannerGridConfig = GridFieldConfig_RelationEditor::create();
        if ($this->Banners()->Count() > 0) {
            $bannerGridConfig->addComponent(new GridFieldOrderableRows());
        }

        $fields->addFieldToTab(
            'Root.Main',
            GridField::create(
                'Banners',
                'Banner',
                $this->Banners(),
                $bannerGridConfig
            )
        );

        $this->extend('updateCMSFields', $fields);

        return $fields;
    }
288774
public function allActive(bool $slugify = true): array
    {
        global $blog_id; // Blog ID.

        $cache_key = '_'.(int) $blog_id.(int) $slugify;

        if (isset(static::$cache[__FUNCTION__][$cache_key])) {
            return static::$cache[__FUNCTION__][$cache_key];
        }
        $active         = $this->active($slugify);
        $network_active = $this->networkActive($slugify);
        $all_active     = array_merge($active, $network_active);

        if (!$slugify) { // Numeric keys.
            $all_active = array_unique($all_active);
        }
        return static::$cache[__FUNCTION__][$cache_key] = $all_active;
    }
471560
function (instance, sourceFields) {
        var slugParts = sourceFields.map(function (slugSourceField) {
            return instance[slugSourceField];
        });

        var options = (slugOptions && slugOptions.slugOptions) || { lower: true};
        return slug(slugParts.join(' '), options);
    }
514113
public function getSEOFields()
    {
        // Variables
        $config = SiteConfig::current_site_config();
        $SEO = [];
        // Canonical
        if ($config->CanonicalEnabled()) {
            $SEO[] = ReadonlyField::create('ReadonlyMetaCanonical', 'link rel="canonical"', $this->owner->AbsoluteLink());
        }
        // Title
        if ($config->TitleEnabled()) {
            $SEO[] = TextField::create('MetaTitle', 'meta title')
                ->setAttribute('placeholder', $this->owner->GenerateTitle());
        }
        // Description
        $SEO[] = TextareaField::create('MetaDescription', 'meta description')
            ->setAttribute('placeholder', $this->owner->GenerateDescriptionFromContent());
        // ExtraMeta
        if ($config->ExtraMetaEnabled()) {
            $SEO[] = TextareaField::create('ExtraMeta', 'Custom Metadata');
        }
        return $SEO;
    }
466462
protected function _conditions($entity, $slug)
    {
        /** @var string $primaryKey */
        $primaryKey = $this->_table->getPrimaryKey();
        $field = $this->_table->aliasField($this->getConfig('field'));

        $conditions = [$field => $slug];

        if (is_callable($this->getConfig('scope'))) {
            $scope = $this->getConfig('scope');
            $conditions += $scope($entity);
        } else {
            $conditions += $this->getConfig('scope');
        }

        if ($id = $entity->{$primaryKey}) {
            $conditions['NOT'][$this->_table->aliasField($primaryKey)] = $id;
        }

        return $conditions;
    }