public function initFormProperties(array $properties)
    {
        /** @var core_kernel_classes_Property $property */
        foreach ($properties as $property) {
            $property->feed();
            $widget = $this->getWidgetProperty($property);

            if (is_null($widget) || $widget instanceof core_kernel_classes_Literal) {
                continue;
            }

            $propertyData = [
                'uri' => $property->getUri(),
                'label' => $property->getLabel(),
                'widget' => $widget->getUri(),
            ];

            // Validators
            $validators = $this->getPropertyValidators($property);
            if (!empty($validators)) {
                $propertyData['validators'] = $validators;
            }

            // Range values
            /** @var core_kernel_classes_Class $range */
            $range = $property->getRange();
            if (!is_null($range) && $range->getUri() != 'http://www.w3.org/2000/01/rdf-schema#Literal') {
                $propertyData['range'] = $range->getUri();
                $this->ranges[$range->getUri()] = $this->getRangeData($range);
            }

            // Existing values
            if (
                $this->doesExist()
                && !is_null($value = $this->getFieldValue($property, isset($propertyData['range']) ? $propertyData['range'] : null))
            ) {
                $propertyData['value'] = $value;
            }

            // Field position in the form
            $guiPropertyOrder = $property->getOnePropertyValue($this->getProperty(TaoOntology::PROPERTY_GUI_ORDER));
            if (!is_null($guiPropertyOrder)) {

                $position = intval((string)$guiPropertyOrder);
                $propertyData['position'] = $position;
                $i = 0;
                while (
                    $i < count($this->formProperties)
                    && (isset($this->formProperties[$i]['position']) && $position >= $this->formProperties[$i]['position'])
                ) {
                    $i++;
                }
                array_splice($this->formProperties, $i, 0, array($propertyData));

            } else {
                $this->formProperties[] = $propertyData;
            }

        }
    }
public function initFormProperties(array $properties)
    {
        /** @var core_kernel_classes_Property $property */
        foreach ($properties as $property) {
            $property->feed();
            $widget = $this->getWidgetProperty($property);

            if (is_null($widget) || $widget instanceof core_kernel_classes_Literal) {
                continue;
            }

            $propertyData = [
                'uri' => $property->getUri(),
                'label' => $property->getLabel(),
                'widget' => $widget->getUri(),
            ];

            // Validators
            $validators = $this->getPropertyValidators($property);
            if (!empty($validators)) {
                $propertyData['validators'] = $validators;
            }

            // Range values
            /** @var core_kernel_classes_Class $range */
            $range = $property->getRange();
            if (!is_null($range) && $range->getUri() != 'http://www.w3.org/2000/01/rdf-schema#Literal') {
                $propertyData['range'] = $range->getUri();
                $this->ranges[$range->getUri()] = $this->getRangeData($range);
            }

            // Existing values
            if (
                $this->doesExist()
                && !is_null($value = $this->getFieldValue($property, isset($propertyData['range']) ? $propertyData['range'] : null))
            ) {
                $propertyData['value'] = $value;
            }

            // Field position in the form
            $guiPropertyOrder = $property->getOnePropertyValue($this->getProperty(TaoOntology::PROPERTY_GUI_ORDER));
            if (!is_null($guiPropertyOrder)) {

                $position = intval((string)$guiPropertyOrder);
                $propertyData['position'] = $position;
                $i = 0;
                while (
                    $i < count($this->formProperties)
                    && (isset($this->formProperties[$i]['position']) && $position >= $this->formProperties[$i]['position'])
                ) {
                    $i++;
                }
                array_splice($this->formProperties, $i, 0, array($propertyData));

            } else {
                $this->formProperties[] = $propertyData;
            }

        }
    }
public function initFormProperties ( array $ properties ) { /** @var core_kernel_classes_Property $property */ foreach ( $ properties as $ property ) { $ property -> feed ( ) ; $ widget = $ this -> getWidgetProperty ( $ property ) ; if ( is_null ( $ widget ) || $ widget instanceof core_kernel_classes_Literal ) { continue ; } $ propertyData = [ 'uri' => $ property -> getUri ( ) , 'label' => $ property -> getLabel ( ) , 'widget' => $ widget -> getUri ( ) , ] ; // Validators $ validators = $ this -> getPropertyValidators ( $ property ) ; if ( ! empty ( $ validators ) ) { $ propertyData [ 'validators' ] = $ validators ; } // Range values /** @var core_kernel_classes_Class $range */ $ range = $ property -> getRange ( ) ; if ( ! is_null ( $ range ) && $ range -> getUri ( ) != 'http://www.w3.org/2000/01/rdf-schema#Literal' ) { $ propertyData [ 'range' ] = $ range -> getUri ( ) ; $ this -> ranges [ $ range -> getUri ( ) ] = $ this -> getRangeData ( $ range ) ; } // Existing values if ( $ this -> doesExist ( ) && ! is_null ( $ value = $ this -> getFieldValue ( $ property , isset ( $ propertyData [ 'range' ] ) ? $ propertyData [ 'range' ] : null ) ) ) { $ propertyData [ 'value' ] = $ value ; } // Field position in the form $ guiPropertyOrder = $ property -> getOnePropertyValue ( $ this -> getProperty ( TaoOntology :: PROPERTY_GUI_ORDER ) ) ; if ( ! is_null ( $ guiPropertyOrder ) ) { $ position = intval ( ( string ) $ guiPropertyOrder ) ; $ propertyData [ 'position' ] = $ position ; $ i = 0 ; while ( $ i < count ( $ this -> formProperties ) && ( isset ( $ this -> formProperties [ $ i ] [ 'position' ] ) && $ position >= $ this -> formProperties [ $ i ] [ 'position' ] ) ) { $ i ++ ; } array_splice ( $ this -> formProperties , $ i , 0 , array ( $ propertyData ) ) ; } else { $ this -> formProperties [ ] = $ propertyData ; } } }
Initialize form properties.
- Only if resource property has a widget property
- Fetch property validator
- If necessary fetch property ranges
- In case of edition, retrieve property values
- Sort properties with GUI order property

@param array $properties
Initialize form properties . - Only if resource property has a widget property - Fetch property validator - If necessary fetch property ranges - In case of edition retrieve property values - Sort properties with GUI order property