Add Featured news attribute to Add news page

Permalink Browser Info Environment
Hi,

Would it be possible to add the is_featured attribute checkbox also to the page where you add a new item?

This way the user could choose the checkbox when making the news entry and not have to go through extra hoops to get it.

Type: Discussion
Status: New
Hypocrite
View Replies: View Best Answer
hanicker replied on at Permalink Best Answer Reply
hanicker
Try following
edit singles_pages\dashboard\easy_news\view.php
add below
<strong><?php echo $form->label('newsDescription', t('Summary'))?></strong>
   <div><?php echo $form->textarea('newsDescription', $newsDescription, array_merge(array('style' => 'width: 730px; height: 100px'),$miscFields))?></div>
   <br/>

code
<strong><?php echo $form->label('featured', t('Featured'))?></strong>
   <div><?php echo $form->checkbox('featured', '1', $featured)?></div>
   <br/>

and below
$cParentID = $news->getCollectionParentID();

code
$featured = $news->getAttribute('is_featured');


edit controllers\dashboard\easy_news\controller.php
replace
private function saveData($p) {
      $blocks = $p->getBlocks('Main');

with
private function saveData($p) {
      $f=$this->post('featured');
      $p->setAttribute('is_featured',$f=='1');
      $blocks = $p->getBlocks('Main');


Let me know if this works.
Regards
Nick
Hypocrite replied on at Permalink Reply
Hypocrite
Thanks, worked like a charm. :)

concrete5 Environment Information

Browser User-Agent String

Hide Post Content

This will replace the post content with the message: "Content has been removed by an Administrator"

Hide Content

Request Refund

You have not specified a license for this support ticket. You must have a valid license assigned to a support ticket to request a refund.