Git Product home page Git Product logo

serial's Introduction

serial's People

Contributors

colorfield avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

serial's Issues

Implement SerialItem

Extend FieldItemBase as as replacement of hook_field_info, hook_field_schema and hook_field_is_empty.

Field settings and cardinality

It is currently designed like this in the D7 version of Serial, but makes me unsure about the model. Should the site builder be able to define the cardinality of the field (should always be 1, no ?) or define the field as not required ?
Also, it can be considered with Make serial IDs optional, so the settings could probably be replaced by a clearer configuration screen for the end user.
See #5

serial-required
serial-values

Handle atomicity

The schema and update hooks have to be converted.

  • serial_schema
  • serial_field_schema (documentation for D8)
  • serial_update_7130, serial_update_7131, serial_update_7132

The module does not create any table on install. It triggers table creation while creating a field on a content type. The table created is then "serial_" suffixed with a md5 generated string 'serial_' . md5("{$entity_type}{$bundle}{$field_name}").
There was already a todo left under D7 about improving this naming convention.

function _serial_get_table_name($entity_type, $bundle, $field_name) {
  // Remember about max length of MySQL tables - 64 symbols.
  // @todo Think about improvement for this.
  return db_escape_table('serial_' . md5("{$entity_type}_{$bundle}_{$field_name}"));
}

The table columns are sid - primary key ("The atomic serial field") and uniqid - unique key ("Unique temporary allocation Id") that relies on http://php.net/manual/en/function.uniqid.php.

Create a service that wraps serial storage operations

Storage operations should be encapsulated in a service for usage amongst the classes.
It will also allow easy implementation change.

Operations to implement (interface)

  • create storage
  • drop storage
  • init old entities
  • rename storage
  • get storage name
  • generate schema
  • generate value

SerialItem should not be translatable by default

Currently, dependending on the content translation configuration you follow (create serial field then install Content translation module), you have to uncheck translation for the serial field in admin/config/regional/content-language (or e.g. admin/structure/types/manage/article/fields/node.article.field_serial) which is probably unfair because in most use cases, the serial id should follow the entity translation concept where node id's are the same, unlike i18n in D7 (see related issue Serial Field with translated nodes).

Implement field create and delete instance operations

The D7 version implemented hook_field_create_instance() which is not available anymore.
It had 2 side effects

  1. Create the dedicated serial table (see discussion in #2)
  2. Update the existing entities instances (e.g. nodes)

hook_field_delete_instance() operations must be implemented as well.

Manage display form cannot be accessed

The Manage display form throws "Drupal\Component\Plugin\Exception\PluginException: The plugin (integer) did not specify an instance class. in Drupal\Component\Plugin\Factory\DefaultFactory::getPluginClass() (line 79 of /var/www/drupal82/core/lib/Drupal/Component/Plugin/Factory/DefaultFactory.php)."

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.