-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathDoFormBase.php
More file actions
80 lines (66 loc) · 1.67 KB
/
Copy pathDoFormBase.php
File metadata and controls
80 lines (66 loc) · 1.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<?php
/**
* @file
* Contains \DrupalPatchUtils\DoFormBase.
*/
namespace DrupalPatchUtils;
use Symfony\Component\DomCrawler\Form;
class DoFormBase {
const STATUS_ACTIVE = 1;
const STATUS_NEEDS_WORK = 13;
const STATUS_NEEDS_REVIEW = 8;
const STATUS_RTBC = 14;
const STATUS_PATCH = 15;
const STATUS_FIXED = 2;
const STATUS_POSTPONED = 14;
const STATUS_POSTPONED_MORE_INFO = 16;
const STATUS_CLOSED_DUPLICATE = 3;
const STATUS_CLOSED_WONT_FIX = 5;
const STATUS_CLOSED_WORKS = 6;
const STATUS_CLOSED_CANT_REPRODUCE = 18;
const STATUS_CLOSED_FIXED = 7;
const TAG_NEEDS_REROLL = 'Needs reroll';
/**
* @var \Symfony\Component\DomCrawler\Form
*/
protected $form;
public function __construct (Form $form) {
$this->form = $form;
}
/**
* @return $this
*/
public function setStatusNeedsWork() {
$this->setStatus(static::STATUS_NEEDS_WORK);
return $this;
}
public function ensureTag($value) {
$tags = $this->form->get('taxonomy_vocabulary_9[und]');
if (strpos($tags->getValue(), $value) === FALSE) {
if (strlen($tags->getValue()) == 0) {
$tags->setValue($value);
}
else {
$tags->setValue($tags->getValue() . ', '. $value);
}
$this->form->set($tags);
}
}
public function getForm () {
return $this->form;
}
/**
* @param integer $value
* @return $this
*/
protected function setStatus($value) {
$status = $this->form->get('field_issue_status[und]');
$status->setValue($value);
$this->form->set($status);
return $this;
}
public function getStatus() {
$status = $this->form->get('field_issue_status[und]');
return $status->getValue();
}
}