Refactor of Compiler Fields Class #955

Open
opened 2022-08-30 08:33:43 +00:00 by Llewellyn · 1 comment
Owner
All [Fields](https://git.vdm.dev/joomla/Component-Builder/src/tag/v3.1.5/admin/helpers/compiler/c_Fields.php) methods needs to move to [power] class, so we can add them all to a containerized implementation. - [x] [buildSiteFieldData](https://git.vdm.dev/joomla/Component-Builder/src/tag/v3.1.5/admin/helpers/compiler/c_Fields.php#L4044) - [ ] [getCustomFieldCode](https://git.vdm.dev/joomla/Component-Builder/src/tag/v3.1.5/admin/helpers/compiler/c_Fields.php#L5683) - [x] [getFieldsetXML](https://git.vdm.dev/joomla/Component-Builder/src/tag/v3.1.5/admin/helpers/compiler/c_Fields.php#L1764) - [x] [getFieldXMLString](https://git.vdm.dev/joomla/Component-Builder/src/tag/v3.1.5/admin/helpers/compiler/c_Fields.php#L1828) - [x] [hasPermissionsSet](https://git.vdm.dev/joomla/Component-Builder/src/tag/v3.1.5/admin/helpers/compiler/c_Fields.php#L1486) - [x] [setAddButtonToListField](https://git.vdm.dev/joomla/Component-Builder/src/tag/v3.1.5/admin/helpers/compiler/c_Fields.php#L6125) - [x] [setBuilders](https://git.vdm.dev/joomla/Component-Builder/src/tag/v3.1.5/admin/helpers/compiler/c_Fields.php#L4584) - [x] [setCustomFieldTypeFile](https://git.vdm.dev/joomla/Component-Builder/src/tag/v3.1.5/admin/helpers/compiler/c_Fields.php#L5300) - [x] [setDynamicField](https://git.vdm.dev/joomla/Component-Builder/src/tag/v3.1.5/admin/helpers/compiler/c_Fields.php#L1585) - [x] [setField](https://git.vdm.dev/joomla/Component-Builder/src/tag/v3.1.5/admin/helpers/compiler/c_Fields.php#L1887) - [x] [setFieldAttributes](https://git.vdm.dev/joomla/Component-Builder/src/tag/v3.1.5/admin/helpers/compiler/c_Fields.php#L4121) - [ ] [setFieldFilterListSet](https://git.vdm.dev/joomla/Component-Builder/src/tag/v3.1.5/admin/helpers/compiler/c_Fields.php#L5938) - [ ] [setFieldFilterSet](https://git.vdm.dev/joomla/Component-Builder/src/tag/v3.1.5/admin/helpers/compiler/c_Fields.php#L5742) - [x] [setFieldSet](https://git.vdm.dev/joomla/Component-Builder/src/tag/v3.1.5/admin/helpers/compiler/c_Fields.php#L400) - [x] [setFieldsNames](https://git.vdm.dev/joomla/Component-Builder/src/tag/v3.1.5/admin/helpers/compiler/c_Fields.php#L1564) - [ ] [setFilterFieldFile](https://git.vdm.dev/joomla/Component-Builder/src/tag/v3.1.5/admin/helpers/compiler/c_Fields.php#L6065) - [x] [setLayoutBuilder](https://git.vdm.dev/joomla/Component-Builder/src/tag/v3.1.5/admin/helpers/compiler/c_Fields.php#L3972) - [x] [setLine](https://git.vdm.dev/joomla/Component-Builder/src/tag/v3.1.5/admin/helpers/compiler/c_Fields.php#L379) - [x] [simpleXMLFieldSet](https://git.vdm.dev/joomla/Component-Builder/src/tag/v3.1.5/admin/helpers/compiler/c_Fields.php#L1019) - [x] [simpleXMLSetField](https://git.vdm.dev/joomla/Component-Builder/src/tag/v3.1.5/admin/helpers/compiler/c_Fields.php#L2948) - [x] [stringFieldSet](https://git.vdm.dev/joomla/Component-Builder/src/tag/v3.1.5/admin/helpers/compiler/c_Fields.php#L607) - [x] [stringSetField](https://git.vdm.dev/joomla/Component-Builder/src/tag/v3.1.5/admin/helpers/compiler/c_Fields.php#L1932) - [x] [xmlIndent](https://git.vdm.dev/joomla/Component-Builder/src/tag/v3.1.5/admin/helpers/compiler/c_Fields.php#L6491) - [x] [xmlPrettyPrint](https://git.vdm.dev/joomla/Component-Builder/src/tag/v3.1.5/admin/helpers/compiler/c_Fields.php#L6438)
Llewellyn added this to the Compiler Refactoring milestone 2022-08-30 08:33:43 +00:00
Llewellyn self-assigned this 2022-08-30 08:33:43 +00:00
Llewellyn added this to the Joomla 4 project 2022-08-30 08:33:43 +00:00
Author
Owner

@ro-ot, the last two weeks I was working on making sure all the previous changes are stable, before moving on, and yet I still moved things as needed.

This is the list of methods and properties from this fields class that I am going to move next, using my small script:

--------------------------
$this->...[
--------------------------
$this->metadataBuilder[
$this->accessBuilder[
$this->fieldsNames[
$this->hasPermissions[
$this->zeroOrderFix[
$this->tabCounter[
$this->layoutBuilder[
$this->movedPublishingFields[
$this->newPublishingFields[
$this->listFieldClass[
$this->doNotEscape[
$this->customBuilderList[
$this->hiddenFieldsBuilder[
$this->intFieldsBuilder[
$this->dynamicfieldsBuilder[
$this->maintextBuilder[
$this->customBuilder[
$this->customFieldLinksBuilder[
$this->setScriptUserSwitch[
$this->setScriptMediaSwitch[
$this->categoryBuilder[
$this->catCodeBuilder[
$this->checkboxBuilder[
$this->jsonStringBuilder[
$this->base64Builder[
$this->basicFieldModeling[
$this->whmcsFieldModeling[
$this->mediumFieldModeling[
$this->expertFieldModelInitiator[
$this->expertFieldModeling[
$this->jsonItemBuilder[
$this->getItemsMethodListStringFixBuilder[
$this->jsonItemBuilderArray[
$this->getItemsMethodEximportStringFixBuilder[
$this->selectionTranslationFixBuilder[
$this->sortBuilder[
$this->searchBuilder[
$this->filterBuilder[
$this->siteFieldData[
$this->fileContentDynamic[
$this->setGroupControl[
$this->extentionCustomfields[
$this->permissionCore[
$this->permissionBuilder[
--------------------------
$this->...->
--------------------------
$this->app->
--------------------------
$this->...(
--------------------------
$this->stringFieldSet(
$this->simpleXMLFieldSet(
$this->setDynamicField(
$this->hasPermissionsSet(
$this->setLayoutBuilder(
$this->xmlPrettyPrint(
$this->setFieldAttributes(
$this->setFieldsNames(
$this->setField(
$this->setBuilders(
$this->xmlIndent(
$this->stringSetField(
$this->simpleXMLSetField(
$this->buildSiteFieldData(
$this->setCustomFieldTypeFile(
$this->setAddButtonToListField(
$this->getAttribute(
--------------------------
CFactory::_(...)->
--------------------------
CFactory::_('Config')->
CFactory::_('Placeholder')->
CFactory::_('Language')->
CFactory::_('Event')->
CFactory::_('Utilities.Counter')->
CFactory::_('Field.Name')->
CFactory::_('Field.Type.Name')->
CFactory::_('Customcode')->
CFactory::_('Registry')->
CFactory::_('Field')->
CFactory::_('Content')->
CFactory::_('Component.Placeholder')->
CFactory::_('Utilities.Structure')->
--------------------------
Helpers::_()
--------------------------
ArrayHelper::check(
Indent::_(
Line::_(
StringHelper::check(
ComponentbuilderHelper::xmlComment(
ComponentbuilderHelper::xmlAddAttributes(
ComponentbuilderHelper::xmlAppend(
ObjectHelper::check(
ComponentbuilderHelper::fieldCheck(
JText::_(
GetHelper::between(
StringHelper::safe(
ComponentbuilderHelper::openValidBase64(
FieldHelper::safe(
ComponentbuilderHelper::getValueFromXMLstring(
JText::sprintf(
Placefix::_(
Placefix::b(
Placefix::d(
Placefix::h(
JFormHelper::loadFieldClass(
parent::getInput(
JFactory::getApplication(
JUri::getInstance(
JFactory::getUser(
JFactory::getDocument(

Which is about 5000 lines. I first move all the class properties that should be global (as part of the registry, or be in its own class) then I update all of the old compiler code to use these new approach. Then I move the component helper class methods, to their own classes. Then I move each function into its own class... this is my workflow at the moment... very boring work really, only the last part when moving the functions gets to be a little more interesting, as I then get to really refactor stuff.

I am not really sure what you can do without waiting for me, unless you also target a set of functions outside of the above scope. I will contact you about the master instance.

@ro-ot, the last two weeks I was working on making sure all the previous changes are stable, before moving on, and yet I still moved things as needed. This is the list of methods and properties from this fields class that I am going to move next, [using my small script](https://git.vdm.dev/joomla/Component-Builder/issues/964#issuecomment-19040): ``` -------------------------- $this->...[ -------------------------- $this->metadataBuilder[ $this->accessBuilder[ $this->fieldsNames[ $this->hasPermissions[ $this->zeroOrderFix[ $this->tabCounter[ $this->layoutBuilder[ $this->movedPublishingFields[ $this->newPublishingFields[ $this->listFieldClass[ $this->doNotEscape[ $this->customBuilderList[ $this->hiddenFieldsBuilder[ $this->intFieldsBuilder[ $this->dynamicfieldsBuilder[ $this->maintextBuilder[ $this->customBuilder[ $this->customFieldLinksBuilder[ $this->setScriptUserSwitch[ $this->setScriptMediaSwitch[ $this->categoryBuilder[ $this->catCodeBuilder[ $this->checkboxBuilder[ $this->jsonStringBuilder[ $this->base64Builder[ $this->basicFieldModeling[ $this->whmcsFieldModeling[ $this->mediumFieldModeling[ $this->expertFieldModelInitiator[ $this->expertFieldModeling[ $this->jsonItemBuilder[ $this->getItemsMethodListStringFixBuilder[ $this->jsonItemBuilderArray[ $this->getItemsMethodEximportStringFixBuilder[ $this->selectionTranslationFixBuilder[ $this->sortBuilder[ $this->searchBuilder[ $this->filterBuilder[ $this->siteFieldData[ $this->fileContentDynamic[ $this->setGroupControl[ $this->extentionCustomfields[ $this->permissionCore[ $this->permissionBuilder[ -------------------------- $this->...-> -------------------------- $this->app-> -------------------------- $this->...( -------------------------- $this->stringFieldSet( $this->simpleXMLFieldSet( $this->setDynamicField( $this->hasPermissionsSet( $this->setLayoutBuilder( $this->xmlPrettyPrint( $this->setFieldAttributes( $this->setFieldsNames( $this->setField( $this->setBuilders( $this->xmlIndent( $this->stringSetField( $this->simpleXMLSetField( $this->buildSiteFieldData( $this->setCustomFieldTypeFile( $this->setAddButtonToListField( $this->getAttribute( -------------------------- CFactory::_(...)-> -------------------------- CFactory::_('Config')-> CFactory::_('Placeholder')-> CFactory::_('Language')-> CFactory::_('Event')-> CFactory::_('Utilities.Counter')-> CFactory::_('Field.Name')-> CFactory::_('Field.Type.Name')-> CFactory::_('Customcode')-> CFactory::_('Registry')-> CFactory::_('Field')-> CFactory::_('Content')-> CFactory::_('Component.Placeholder')-> CFactory::_('Utilities.Structure')-> -------------------------- Helpers::_() -------------------------- ArrayHelper::check( Indent::_( Line::_( StringHelper::check( ComponentbuilderHelper::xmlComment( ComponentbuilderHelper::xmlAddAttributes( ComponentbuilderHelper::xmlAppend( ObjectHelper::check( ComponentbuilderHelper::fieldCheck( JText::_( GetHelper::between( StringHelper::safe( ComponentbuilderHelper::openValidBase64( FieldHelper::safe( ComponentbuilderHelper::getValueFromXMLstring( JText::sprintf( Placefix::_( Placefix::b( Placefix::d( Placefix::h( JFormHelper::loadFieldClass( parent::getInput( JFactory::getApplication( JUri::getInstance( JFactory::getUser( JFactory::getDocument( ``` Which is about 5000 lines. I first move all the class properties that should be global (as part of the registry, or be in its own class) then I update all of the old compiler code to use these new approach. Then I move the component helper class methods, to their own classes. Then I move each function into its own class... this is my workflow at the moment... very boring work really, only the last part when moving the functions gets to be a little more interesting, as I then get to really refactor stuff. I am not really sure what you can do without waiting for me, unless you also target a set of functions outside of the above scope. I will contact you about the master instance.
Sign in to join this conversation.
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: joomla/Component-Builder#955
No description provided.