Get the list of custom :attribute placeholders values.

@param array $fields The form fields instances.

@return array
492762
protected function getFormPlaceholders(array $fields)
    {
        $attributes = [];

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

        return $attributes;
    }
251603
public function generateFields(array $fields): array
    {
        $traitFqns = [];
        foreach ($fields as list($fieldFqn, $fieldType)) {
            try {
                $traitFqns[] = $this->fieldGenerator->generateField($fieldFqn, $fieldType);
            } catch (\Exception $e) {
                throw new \RuntimeException(
                    'Failed building field with $fieldFqn: ' . $fieldFqn . ' and $fieldType ' . $fieldType,
                    $e->getCode(),
                    $e
                );
            }
        }

        return $traitFqns;
    }
561439
public function SmallFieldHolder($properties = array())
    {
        $context = $this;

        if (count($properties)) {
            $context = $this->customise($properties);
        }

        return $context->renderWith($this->getSmallFieldHolderTemplates());
    }
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;
    }
615814
private function getAttributeValues($attribute, $attributeValues)
    {
        $values = [];
        foreach ($attributeValues as $attributeValue) {
            if ($attribute['id'] == $attributeValue['attributeId']) {
                $values[] = $attributeValue;
            }
        }

        return $values;
    }
49090
protected function getValidationRules(array $fields)
    {
        $rules = [];

        foreach($fields as $field => $data){

            if($data['validate']) $rules[$field] = $data['validate'];

        }

        return $rules;
    }
407519
public function attributes($field)
    {
        if (!is_array($this->_context['schema'])) {
            return [];
        }
        $schema = Hash::get($this->_context['schema'], $field);
        if ($schema === null) {
            $schema = Hash::get($this->_context['schema'], $this->stripNesting($field));
        }
        $whitelist = ['length' => null, 'precision' => null];

        return array_intersect_key((array)$schema, $whitelist);
    }
162609
protected function getDataMethod(array $fields)
    {
        $stub = $this->getStubContent('controller-getdata-method');

        $this->replaceFileSnippet($stub, $this->getFileSnippet($fields, '$this'))
            ->replaceValidationRules($stub, $this->getValidationRules($fields))
            ->replaceFillables($stub, $this->getFillables($fields))
            ->replaceBooleadSnippet($stub, $this->getBooleanSnippet($fields))
            ->replaceStringToNullSnippet($stub, $this->getStringToNullSnippet($fields))
            ->replaceRequestNameComment($stub, '')
            ->replaceMethodVisibilityLevel($stub, 'public');

        $stub = str_replace(PHP_EOL . PHP_EOL, PHP_EOL, $stub);

        return $stub;
    }
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);
    }
1107401
private function parseFields(array $fields)
    {
        $propertyStub = $this->generateProperty();
        $setterStub   = $this->generateSetter();
        $getterStub   = $this->generateGetter();
        foreach ($fields as $fieldInfo) {
            $this->parseProperty($propertyStub, $fieldInfo);
            $this->parseSetter($setterStub, $fieldInfo);
            $this->parseGetter($getterStub, $fieldInfo);
        }
    }
1198709
public function FieldHolder($properties = array())
    {
        $content = $this->content;

        if ($content instanceof ViewableData) {
            if ($properties) {
                $content = $content->customise($properties);
            }

            $content = $content->forTemplate();
        }

        if($this->config()->allow_html === true) {
            return '<div class="'.$this->classes.'"" name="'.$this->getName().'">'.$content.'</div>';
        } else {
            return '<p class="'.$this->classes.'"" name="'.$this->getName().'">'.$content.'</p>';
        }
    }
983938
protected function getValidationRules(array $fields)
    {
        $validations = '';

        foreach ($fields as $field) {

            $rules = $field->getValidationRule();
            $customRules = $this->extractCustomValidationRules($rules);

            if (!empty($rules)) {

                if ($field->isFile()) {
                    $rules = array_filter($rules, function ($rule) {
                        return $rule != 'required';
                    });
                }

                if (!empty($customRules) || $field->isFile()) {

                    $standardRules = array_diff($rules, $customRules);
                    $shortCustomRules = $this->extractCustomValidationShortName($customRules);

                    $wrappedRules = array_merge(Helpers::wrapItems($standardRules), $shortCustomRules);
                    $validations .= sprintf("        '%s' => [%s],\n    ", $field->name, implode(',', $wrappedRules));
                } else {
                    $validations .= sprintf("        '%s' => '%s',\n    ", $field->name, implode('|', $rules));
                }
            }
        }

        return $validations;
    }
219094
protected function parseAttributes(string $attributes):array{
		$attr = [];

		if(empty($attributes)){
			return $attr;
		}

		// @todo: fix attributes pattern: accept single and double quotes around the value
		if(preg_match_all('#(?<name>^|[[a-z]+)\=(["\']?)(?<value>[^"\']*?)\2(?: |$)#i', $attributes, $matches, PREG_SET_ORDER) > 0){
#			print_r(['$attributes' => $attributes, '$matches' => $matches]);

			foreach($matches as $attribute){
				$name = empty($attribute['name']) ? $this->options->placeholder_bbtag : strtolower(trim($attribute['name']));

				$attr[$name] = trim($attribute['value'], '"\' ');
			}
		}

		$e = preg_last_error();

		if($e !== PREG_NO_ERROR){
			$this->logger->debug('preg_error', ['errno' => $e, '$attributes' => $attributes]);
			$attr['__error__'] = $attributes;
		}

		return $attr;
	}
1149678
public function FieldHolder($attributes = array ()) {
		Requirements::javascript(BOOTSTRAP_FORMS_DIR."/javascript/tinymce/jscripts/tiny_mce/jquery.tinymce.js");
    	Requirements::javascript(BOOTSTRAP_FORMS_DIR."/javascript/tinymce/jscripts/tiny_mce/tiny_mce.js");		
    	if(!$this->getAttribute('data-buttons')) {
    		$this->setButtons(self::$default_buttons);
    	}
    	if(!$this->getAttribute('data-blockformats')) {
    		$this->setBlockFormats(self::$default_blockformats);
    	}

		$this->addExtraClass('wysiwyg');
		return parent::FieldHolder($attributes);
	}
382871
public function encodeValues(array $fields)
    {
        $output = [];

        foreach ($fields as $key => $val) {
            $output[$key] = $this->encodeValue($val);
        }

        return $output;
    }
13931
private static function getFieldNameArray($fields)
    {
        if (count($fields) === 0) {
            return;
        }

        $names = array();

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

        return $names;
    }
1360786
public static function fieldListToUpdateString($fields)
    {
        $formattedFields = [];
        foreach ($fields as $field) {
            $fieldWithEqualsColonPrefix = $field . ' = :' . $field;
            $formattedFields[] = $fieldWithEqualsColonPrefix;
        }

        return ' ' . implode(', ', $formattedFields) . ' ';
    }