Currently, we have:

    id:
      type: string
      label: 'Flag identifier'
    label:
      type: label
      label: 'Name'

For node types:

    name:
      type: label
      label: 'Name'
    type:
      type: string
      label: 'Machine-readable name'

We can't use 'type' for the machine name, so I'm not sure we can be consistent with node module, but 'id' doesn't seem right for a machine name.

Comments

joachim’s picture

Issue summary: View changes
joshi.rohit100’s picture

Status: Active » Needs review
StatusFileSize
new341 bytes

updated 'id' to flag.

Status: Needs review » Needs work

The last submitted patch, 2: flag-2412063-2.patch, failed testing.

joshi.rohit100’s picture

StatusFileSize
new1.99 KB

I tried to update the testcases for this as it seems like testcase problem to me.
I just tried with FlagConfirmFormTest but I am stuck with this :-

   // Click the flag link.
    $this->drupalGet('node/' . $node_id);
    $this->clickLink(t('Flag this item'));
  

I dont know if I am doing right. Can some one guide me in right direction ?

socketwench’s picture

I'm reluctant to change it because when I look at NodeType.php...

<?php
class NodeType extends ConfigEntityBundleBase implements NodeTypeInterface {

  /**
   * The machine name of this node type.
   *
   * @var string
   *
   * @todo Rename to $id.
   */
  protected $type;
?>

That, combined with how "type" and "node" both seem more confusing to me than "id", I'm not inclined to change this.

berdir’s picture

+1 to using id and label and closing this as a won't fix :)

Core has been trying to go into that direction, just never reached it for all entity types, but a lot of them have been renamed.

berdir’s picture

And node type is probably the worst example that core has to offer, both with the double-meaning of type ($type->type? what exactly does $node->getType() return?) and using "name" for the label of a config entity.

socketwench’s picture

Status: Needs work » Closed (won't fix)

It also seems to make more sense given we have an id() and label() methods on EntityInterface, it just seems to make more sense to leave the class variables as they are.