Skip to content

Move static variables in fields into attributes. #2276

@dsenalik

Description

@dsenalik

Task Description

This task is to move the static variables in fields into the attributes sections.

Right now, the id is both an attribute and a static variable, we should be able to get rid of the static variable.
The other static variables can become attributes too, as well as the mainPropertyName function.

This will need an update to the TripalFieldType attribute class added in PR #2266 to add these new attribute keys.

#[TripalFieldType(
  id: 'chado_project_type_default',
  category: 'tripal_chado',
  label: new TranslatableMarkup('Chado Project'),
  description: new TranslatableMarkup('Add a Chado project to the content type.'),
  default_widget: 'chado_project_widget_default',
  default_formatter: 'chado_project_formatter_default',
)]
class ChadoProjectTypeDefault extends ChadoFieldItemBase {

  public static $id = 'chado_project_type_default';
  protected static $object_table = 'project';
  protected static $object_id = 'project_id';

  /**
   * {@inheritdoc}
   */
  public static function mainPropertyName() {
    // Overrides the default of 'value'
    return 'project_name';
  }

Branch Name

tv4g1-issue2276-move-field-static-variables-to-attributes

Metadata

Metadata

Assignees

No one assigned

    Labels

    Group 1 - Tripal Content Types | Terms | FieldsAny issue relating to Tripal Content including types, terms, and fields.Priority - LowAny issue/PR which is not currently a priority according to the PMC.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions