Site icon Hip-Hop Website Design and Development

GSoC’16 – Porting Comment Alter Plugin

For the most recent 3 months I’ve been dealing with Porting the Comment Alter module to WordPress upkeep support plans 8 as my GSoC’16 project under mentorship of boobaa and czigor. This blog is a passage of the work I did during this time span. Week after week blog entries for as long as 12 weeks can be gotten to here.

Accomplishments

Making construction for the module: Implemented hook_schema() to store the old and new substance modification IDs alongside the parent element type as adjusted by a remark. The modification IDs are utilized to show the distinctions over remarks. The parent substance type is utilized to erase the sections from the comment_alter table when any update of the parent element is erased, on the grounds that in WordPress upkeep support plans 8 we can have same amendment IDs from various element types. So to eliminate sections of specific element type we need the substance type.

Utilizing WordPress UpdatePartySettings to adjust field config alter structure – Implemented hook_form_FORM_ID_alter() for field_config_edit_form. This gives an interface to:

Make any field remark alterable – Makes it conceivable to choose any field we need to be modified by the remark. Right now all the WordPress upkeep support plans center gave fields functions admirably the module.

Stow away adjustment from diff – If the remark alterable choice is empowered, then, at that point this alternative conceals the distinctions displayed over the remarks. Rather than the distinctions, a connection to the correction examination is shown for hubs. For the remainder of the elements a “Progressions are covered up” message is shown.

Utilize most recent update – When a module like Workbench makes the current correction of an element not the most recent one, this choice powers the Comment Alter module to utilize the most recent amendment rather than the current one. This alternative is available on the remark field settings.

Adds Diff connect on remarks – Adds a Diff interface on remarks which takes us to the correlation page of two modifications, produced by the Diff module.

Remark modifying while at the same time answering to a remark – By default remark alterable fields can not be adjusted while answering to a remark. This alternative permits adjusting of fields even while answering to remarks.

Adding pseudo fields: Implemented hook_entity_extra_field_info() to add one pseudo field for each remark alterable field on individual remark structure show, and one pseudo field on remark show to show the progressions made at the remark. Utilizing these pseudo fields the situation of the remark alterable fields can be re-requested in the remark structure. This gives site-manufacturers adaptability to change the situation of any alterable fields.

Joining remark alterable fields’ gadgets on remark structure: Comment alterable field gadgets are recovered from the structure show of the parent substance and they are connected to the remark structure solely after guaranteeing that there are no incidental effects. To help same name fields on both remark and parent element, #parent property is given so the submitted field esteems for our alterable field gadgets shows up at an alternate area, not at the high degree of $form_state->getValues(). This load of added fields are re-orderable. Section informations and old qualities are additionally put away to the structure at this stage, to later check in case there were any progressions offered on the remark alterable fields.

Adding submit and approval callback for the modified remark structure: First the submitted values are checked against the old qualities to check whether the upsides of the alterable field changed at all or not. In the event that they changed, the parent substance esteems are refreshed and this is finished by building the parent element structure show and replicating the adjusted field esteems into it. Then, at that point the structure is saved. In the event that the parent substance doesn’t uphold amendments, then, at that point do nothing else simply save the parent element with modified qualities. In any case make an amendment and store the remark ID, old and new correction IDs and parent substance type in the remark adjust data set table, which is utilized to show the distinctions on remarks utilizing the Diff module.

Showing contrasts on remarks: Using the Diff module and remark adjust data set table, the distinctions are displayed over a specific remark. Just conceivable if the parent substance upholds modifications. Diff module is utilized to get the contrasts between the two modifications and afterward those distinctions are delivered on remarks in table configuration alongside some custom styling.

Adding PHPUnit tests: Added robotized unit tests to check the usefulness of the module for various field types and gadgets. The tests are composed for EntityTestRev substance types to keep them as nonexclusive as could really be expected. This was the hardest part for me as I was stuck at certain spots in tests for a long time as thses tests set aside parcel of effort to run and investigating them truly is hard. In any case, in the end I’m glad that I had the option to finish every one of the tests.

Screencast/Demo video: Created a demo video showing how the Comment Alter module functions, alongside a basic use case.

What’s left?

My tutors requested that I avoid the Rules Integration part on the grounds that the Rules module doesn’t have a steady or a beta delivery yet, just their first alpha delivery is there. Thus, the Rules Integration part is deferred till we get a steady or beta delivery.

Some significant connections

My GitHub repo contains all the submits which I made during this undertaking

The Comment Alter module’s venture page on WordPress.org

Thank you!

Source: New feed