public static function build($id, $contents = [], $details = [])
    {
        // Get instance
        try {
            $field = self::getInstance();
        } catch (Exception $e) {
            throw new FieldException(Translate::t('field.errors.class_is_not_defined'));
        }

        // Set class
        $class = get_class($field);
        $hasid = $field->getModel()->getHasId();

        // Check ID
        if ($hasid && empty($id)) {
            throw new FieldException(sprintf(Translate::t('field.errors.field_id_is_not_defined'), $class));
        }

        // Set ID
        $contents['id'] = $id;

        // Set contents and details
        $field->getModel()->setContents($contents);
        $field->getModel()->setDetails($details);

        // Get field
        return $field;
    }
public static function build($id, $contents = [], $details = [])
    {
        // Get instance
        try {
            $field = self::getInstance();
        } catch (Exception $e) {
            throw new FieldException(Translate::t('field.errors.class_is_not_defined'));
        }

        // Set class
        $class = get_class($field);
        $hasid = $field->getModel()->getHasId();

        // Check ID
        if ($hasid && empty($id)) {
            throw new FieldException(sprintf(Translate::t('field.errors.field_id_is_not_defined'), $class));
        }

        // Set ID
        $contents['id'] = $id;

        // Set contents and details
        $field->getModel()->setContents($contents);
        $field->getModel()->setDetails($details);

        // Get field
        return $field;
    }
public static function build ( $ id , $ contents = [ ] , $ details = [ ] ) { // Get instance try { $ field = self :: getInstance ( ) ; } catch ( Exception $ e ) { throw new FieldException ( Translate :: t ( 'field.errors.class_is_not_defined' ) ) ; } // Set class $ class = get_class ( $ field ) ; $ hasid = $ field -> getModel ( ) -> getHasId ( ) ; // Check ID if ( $ hasid && empty ( $ id ) ) { throw new FieldException ( sprintf ( Translate :: t ( 'field.errors.field_id_is_not_defined' ) , $ class ) ) ; } // Set ID $ contents [ 'id' ] = $ id ; // Set contents and details $ field -> getModel ( ) -> setContents ( $ contents ) ; $ field -> getModel ( ) -> setDetails ( $ details ) ; // Get field return $ field ; }
Build Field component.

@param string    $id
@param array     $contents
@param array     $details
Build Field component .