Return a YAML defined array of select field value options.

@param Bag $field

@return array
16012
private function getYamlValues(Bag $field)
    {
        $values = array_slice($field->get('values', []), 0, $field->get('limit', self::DEFAULT_LIMIT), true);
        if ($field->get('sortable')) {
            asort($values, SORT_REGULAR);
        }

        return $values;
    }
26971
public function linkList($field = null)
    {
        $result = [];
        foreach ($this->getFileList() as $path) {
            $name = basename($path);
            $result[$name] = $this->getFileLink($field, basename($path));
        }
        return $result;
    }
825026
public function findField($field=null, $options=null)
    {
        if ($field) {
            $this->select($field);
        }
        $ret = $this->find($options);
        
        return $ret ? array_values($ret)[0] : null;
    }
562226
protected function getField($field)
    {
        if ($this->isFieldSupported($field) && isset($this->fields[ $field ])) {
            return $this->fields[ $field ];
        }

        return null;
    }
719110
public function appendImageSizes($field)
    {
        $sizes = get_intermediate_image_sizes();
        foreach ($sizes as $size) {
            $field['choices'][$size] = $size;
        }

        return $field;
    }
325394
public function getFieldErrors($field) {
		$existing = array_key_get($this->errors['fields'], $field['options']['name']);
		if (!empty($existing)) {
			$result = [
				'type' => null,
				'message' => '',
				'counters' => []
			];
			$sorted = [
				'danger' => [],
				'warning' => [],
				'success' => [],
				'info' => []
			];
			$types = array_keys($existing);
			if (in_array('danger', $types)) {
				$result['type'] = 'danger';
			} else {
				$temp = current($types);
				$result['type'] = $temp;
			}
			// generating text messages
			foreach ($existing as $k => $v) {
				foreach ($v as $k2 => $v2) {
					$result['counters'][$k] = ($result[$k] ?? 0) + 1;
					$sorted[$k][$k2] = $v2;
				}
			}
			foreach ($sorted as $k => $v) {
				if (empty($v)) continue;
				foreach ($v as $k2 => $v2) {
					$result['message'].= \HTML::text(['tag' => 'div', 'class' => 'numbers_field_error_messages', 'data-field_value_hash' => $k2, 'type' => $k, 'value' => $v2]);
				}
			}
			return $result;
		}
		return null;
	}
472906
public function getFormData($field = null)
    {
        $filters = session('bzarzuela.filters');

        if (isset($filters[$this->key]['form_data'])) {

            if (! is_null($field)) {

                if (! isset($filters[$this->key]['form_data'][$field])) {
                    return null;
                }

                return $filters[$this->key]['form_data'][$field];
            }

            return $filters[$this->key]['form_data'];
        }

        if (! is_null($field)) {
            return null;
        }

        return [];
    }
929978
public function getFormFieldValueOptions(FieldInterface $field)
    {
        $options = $field->getOptions();

        $message = '';
        if (isset($options['message'])) {
            $message = $options['message'];
        }

        return ['message' => $message];
    }
487129
public function getFieldErrors(string $field): array {
        if (empty($this->errors[$field])) {
            return [];
        } else {
            $result = [];
            foreach ($this->errors[$field] as $error) {
                $result[] = $this->pluckError($error + ['field' => $field]);
            }
            return $result;
        }
    }
345253
public function attributes($field)
    {
        $parts = explode('.', $field);
        $table = $this->_getTable($parts);
        $column = (array)$table->getSchema()->getColumn(array_pop($parts));
        $whitelist = ['length' => null, 'precision' => null];

        return array_intersect_key($column, $whitelist);
    }
1175278
protected function schema($field = null)
    {
        if ($field === null) {
            return $this->schema;
        } else {
            if (isset($this->schema[$field])) {
                return $this->schema[$field];
            } else {
                return false;
            }
        }
    }
797593
public function map(Field $field)
    {
        $values = array();

        foreach ((array)$field->value as $value) {
            $values[] = $this->convert($value);
        }

        return $values;
    }
472686
final public function getRowFieldValue($field)
    {

        //If value exists;
        if (array_key_exists($field, $this->schema)) {
            return $this->schema[$field]->Value;
        }
        return null;
    }
628636
public function getFieldType($field)
    {
        $definition = $this->getFieldDefinition($field);
        if ($definition && isset($definition['type'])) {
            return $definition['type'];
        }
    }
833965
protected function select(array $field)
    {
        $output = '';

        // Tag around select element: same as for an input element.
        $output .= $this->getWrapper('input');

        // Select tag.
        $attributes = $field['attributes'];
        $attributes = $this->addAttribute($attributes, 'id', $field['id']);
        $attributes = $this->addAttribute($attributes, 'name', $field['name']);
        $output .= $this->getOpenTag('select', $attributes);

        // Options.
        foreach ($field['options'] as $value => $text) {
            $optionAttributes = array('value' => $value);
            if ($this->isOptionSelected($field['value'], $value)) {
                $optionAttributes['selected'] = true;
            }
            $output .= $this->getOpenTag('option', $optionAttributes);
            $output .= htmlspecialchars($text, $this->htmlSpecialCharsFlag, 'UTF-8');
            $output .= $this->getCloseTag('option');
        }

        // End tag.
        $output .= $this->getCloseTag('select');
        // Tag around select element.
        $output .= $this->getWrapperEnd('input');

        return $output;
    }
101735
private function getHlinkField($field)
    {
        if (isset($this->fields[$field['name']]) && is_array($this->fields[$field['name']]))
            return $this->fields[$field['name']];
                      
        $slot = new Cache\Slot\MaterialField($this->table, $this->fields['id'], $field['name']);
        if (false === ($a = $slot->load())) {  
            
            if (!isset($this->fields[$field['name']]))
                $this->fields[$field['name']] = $this->get_plain_field($field);
                        
        	$a = $this->getDbConnection()->fetchAssoc('SELECT * FROM field_link WHERE link_id='.(int)$this->fields[$field['name']]);
            if ($a['structure_id']) {
                if ($a['structure_type'] == 'main') {
                    $c = Catalog::getById($a['structure_id']);
                    if ($c) {
                        $a['link_value'] = $c->url;
            			$a['name'] = $c->name;
        			}
                } else {
        			$b = $this->getDbConnection()->fetchAssoc('SELECT idcat, alias, name FROM '.$a['structure_type'].' WHERE id='.$a['structure_id']);
        			if ($b) {
        			    $c = Catalog::getById($b['idcat']);
        			    if ($c) $path = $c->url;
        				$a['link_value'] = $path.$b['alias'].'.html';
        				$a['alias'] = $b['alias'];
        				$a['idcat'] = $b['idcat'];
        				$a['name'] = $b['name'];
        			}
        		}
            }
            $this->fields[$field['name']] = $a;
        
            $slot->addTag(new Cache\Tag\Material($this->table, $this->fields['id']));
            $slot->save($this->fields[$field['name']]);
            
        } else {
            $this->fields[$field['name']] = $a;
        }
        
        return $this->fields[$field['name']];
    }
269025
public function resolveSelectOptions($field, array $values)
    {
        $options = $this->resolveForSelection($field)
                ->findElements(WebDriverBy::tagName('option'));

        if (empty($options)) {
            return [];
        }

        return array_filter($options, function ($option) use ($values) {
            return in_array($option->getAttribute('value'), $values);
        });
    }