Feature is needed in 7.x that works on files in nodes (and other entities) like mm_node did in 6.x.

I have a working code that supports nodes (and further roadmap to support other entities), but it needs a new name for the submodule. I have few name options (and my opinion in parenthesis):

  1. mm_node (not very good as it does not reflect working on other entities)
  2. mm_filefield (not matching D7 "field" module or "file" module)
  3. mm_entity (too cryptic - what does it do with entity?)
  4. mm_entity_fields
  5. any other?

Any thoughts?

Once name is selected this issue can become the place for patches for new submodule.

Comments

arthurf’s picture

How about mm_fields? Seems like it keeps the flexibility open- meaning that it potentially use the file or image fields- or even operate on a text field in some way. I defer to you, but mm_fields feels easy to me.

iva2k’s picture

Title: mm_node for Drupal 7 » mm_fields for Drupal 7

I like it. mm_fields it is then.

iva2k’s picture

API question (to unblock mm_fields patch):

Table {media_mover_files} has 'nid' column. I want to change it to two columns - 'entity_type', 'entity_id' (so any entity can be managed). There are indexes needed on those (as there will be WHERE clauses), that's why I don't want to put those into 'data' blob.

I can add all appropriate code: hook_update, new methods in class_media_mover_file, etc. hook_update will populate entity_id = 'node' for all 'nid' set, and convert nid into entity_id, so it will be forward-compatible.

Do you agree with the proposal?

arthurf’s picture

Absolutely agreed.

iva2k’s picture

Status: Needs work » Active
StatusFileSize
new16.46 KB

Here's a patch that converts core media mover to Entity API (will be required by mm_fields module). It removes ad-hoc support for node/nid in different stores and makes a consistent use of {media_mover_files}.entity_type/entity_id. There are also some provisions to better maintain fid in the file object and {media_mover_files} table.

This patch depends on the earlier patches I submitted for these issues:

[UPDATE] this patch was duplicated into issue #1930772: Replace nid with enitity_id and entity_type (which is dedicated to its purpose)

iva2k’s picture

Status: Active » Needs review

Setting to "needs review" to try the testbot anyway.

Status: Needs review » Needs work

The last submitted patch, media_mover_entity_api-1926464-5.patch, failed testing.

iva2k’s picture

>The last submitted patch, media_mover_entity_api-1926464-5.patch, failed testing.
Not surprising as it needs the other patches listed in #5.

iva2k’s picture

Status: Active » Needs review
StatusFileSize
new93.22 KB

Here's a patch which introduces a fully working mm_fields submodule.

I beat on testing and making these features work without errors/warnings:

  • full Entity API and fields support (no use of hook_node_XXX)
  • node entities supported fully
  • ready for other entities (comment, user, taxonomy), but disabled in mm_fields_supported_entity_types() as I did not test those.
  • select from entity/fields
  • store to entity/fields, supports derivatives (e.g. from mm_ffmpeg thumbnail step), configurable insertion method
  • field clear step
  • node publishing options (e.g.. publish the node after storing all processed files)

Note that there are core patches needed for this submodule to work properly, however core tests should not fail (this patch does not touch anything in the core):

The features I omitted for now for lack of time (these can be finished later as increments as the code stubs are there):

  • node (or entity) creation on file store (I think it should be merged into the existing "store to entity/field" step)
  • field formatters
  • views integration
  • js code from mm_node
iva2k’s picture

See my full code snapshot (it includes last minute fixes) in comments for #987000: [META] D7 port of media_mover module.

arthurf’s picture

Status: Needs review » Closed (fixed)

Patch in comment committed- this is great!