This module allows developers to create computed fields via the Drupal Plugin API. It adds a field type named computed_render_array and a basic field formatter for it.

The idea behind this was to simplify and unify the way we code. We were inspired by https://www.drupal.org/project/extra_field. Now whether it is blocks, extra fields or computed fields, we can use plugins and less hooks.

Computed fields work a bit like extra fields but they are more flexible because you can still use the native field settings (including formatters).

You can use it to merge several fields as one in the display, or simply render a block, an entity...

For example, you have two link fields that you want to display in the same HTML block. You can create a computed field for that. You can still use your normal fields display if you want, it does not affect the original fields.

Another use case could be to render a block between your content fields. You could also decide to display the block according to another field value.

Requirements

No special requirements.

Similar projects and how they are different

  • Computed Field : This module provides database storage and a back office interface to create computed fields, with a set of field types.
    Our module only allows developpers to create computed fields with the Plugin API like they would create a block for example. There is no database storage or user interface, and any type of field can be extended.

Documentation

https://www.drupal.org/docs/8/modules/computed-field-plugin

Project link

https://www.drupal.org/project/computed_field_plugin

Git instructions

git clone --branch 8.x-1.x https://git.drupalcode.org/project/computed_field_plugin.git

PAReview checklist

https://pareview.sh/pareview/https-git.drupal.org-project-computed_field...

Note: There are still errors because the code sniffer doesn't seem to accept Twig syntax, even though it is a code example in quotes in the readme file. I don't really know how to fix this but I don't believe it is a blocking issue.

Comments

Mupsi created an issue. See original summary.

apaderno’s picture

Issue summary: View changes
Status: Needs review » Needs work

Thank you for applying! I fixed the Git instructions for non-maintainer users, as they were using a not existing branch. Reviewers will check the project and post comments to list what should be changed.

Mupsi’s picture

Thank you for fixing the errors! I'll wait patiently then :)

apaderno’s picture

Status: Needs work » Needs review

The status was not supposed to be changed.

klausi’s picture

Status: Needs review » Reviewed & tested by the community

Thanks for you contribution!

All looking good to me, did not see security issues.

apaderno’s picture

Assigned: Unassigned » apaderno
Status: Reviewed & tested by the community » Fixed

Thank you for your contribution! I am going to update your account.

These are some recommended readings to help with excellent maintainership:

You can find more contributors chatting on the IRC #drupal-contribute channel. So, come hang out and stay involved.
Thank you, also, for your patience with the review process.
Anyone is welcome to participate in the review process. Please consider reviewing other projects that are pending review. I encourage you to learn more about that process and join the group of reviewers.

I thank all the dedicated reviewers as well.

Mupsi’s picture

Thank you both very much! I will check all the documentation you kindly provided :)

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.