colorfield / serial Goto Github PK
View Code? Open in Web Editor NEWDrupal 8 port of the Serial Field module
License: GNU General Public License v2.0
Drupal 8 port of the Serial Field module
License: GNU General Public License v2.0
Roughly, cleaning up of
SerialSQLStorage must implement bundle rename method.
PHPCode Sniffer with Drupal coding standards + cleaning up.
https://www.drupal.org/project/coder
The D7 version implemented hook_field_create_instance() which is not available anymore.
It had 2 side effects
hook_field_delete_instance() operations must be implemented as well.
Forward port https://www.drupal.org/node/2455677
Storage operations should be encapsulated in a service for usage amongst the classes.
It will also allow easy implementation change.
Operations to implement (interface)
Extend FieldItemBase as as replacement of hook_field_info, hook_field_schema and hook_field_is_empty.
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
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)."
Apply Drupal coding standards.
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).
The schema and update hooks have to be converted.
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.