Skip to content

Commit

Permalink
Extends the ArticleType adding a showInEditor option
Browse files Browse the repository at this point in the history
  • Loading branch information
terwey committed Jul 21, 2014
1 parent df4eca0 commit add6e6f
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 2 deletions.
23 changes: 23 additions & 0 deletions newscoop/classes/ArticleTypeField.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ class ArticleTypeField extends DatabaseObject {
'field_type',
'field_type_param',
'is_content_field',
'show_in_editor',
'max_size');
private $m_rootTopicId = null;
private $m_precision = null;
Expand Down Expand Up @@ -285,6 +286,7 @@ public function create($p_type, array $p_params = array())
if ($p_type == self::TYPE_TEXT && isset($p_params['maxsize'])) {
$data['max_size'] = (int)$p_params['maxsize'];
}
$data['show_in_editor'] = (int)$p_params['show_in_editor'];
$data['field_type'] = $p_type;
$data['field_weight'] = $this->getNextOrder();
}
Expand Down Expand Up @@ -755,6 +757,27 @@ public function setIsContent($p_isContent)
}


/**
* Returns int for where to show the field
* @return int
*/
public function showInEditor() {
return $this->m_data['show_in_editor'];
}



/**
* Sets the int for where to show the field
* @param $p_showInEditor
* @return int
*/
public function setShowInEditor($p_showInEditor)
{
return $this->setProperty('show_in_editor', (int)$p_showInEditor);
}


/**
* Quick lookup to see if the current language is already translated for this article type: used by delete and update in setName
* returns 0 if no translation or the phrase_id if there is one.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE `ArticleTypeMetadata` ADD COLUMN `show_in_editor` int(1) NOT NULL DEFAULT '1';
31 changes: 30 additions & 1 deletion newscoop/library/Newscoop/Entity/ArticleTypeField.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,12 @@ class ArticleTypeField
*/
protected $isContentField;

/**
* @ORM\Column(type="integer", name="show_in_editor", nullable=False)
* @var int
*/
protected $showInEditor;

/**
* Get the article type
* @return \Newscoop\Entity\ArticleType
Expand Down Expand Up @@ -307,5 +313,28 @@ public function setIsContentField($isContentField)

return $this;
}
}

/**
* Getter for showInEditor
*
* @return int
*/
public function getShowInEditor()
{
return $this->showInEditor;
}

/**
* Setter for showInEditor
*
* @param int $showInEditor Value to set
*
* @return self
*/
public function setShowInEditor($showInEditor)
{
$this->showInEditor = $showInEditor;

return $this;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,11 @@ Newscoop\Entity\ArticleTypeField:
type: integer
groups: ["details"]
serialized_name: isContentField
since_version: 1.1
since_version: 1.1
showInEditor:
expose: true
read_only: true
type: integer
groups: ["details"]
serialized_name: showInEditor
since_version: 1.1

0 comments on commit add6e6f

Please sign in to comment.