SilentDesigns

Would creating a Filter dataobject and a has_many relationship to the page be the way, to go or is there a simpler way?

SilentDesigns

@nightjarnz - I previously had:

  1. private static $db = [
  2. 'Filters' => 'Varchar'
  3. ];
  4.  
  5. public function getCMSFields() {
  6. $fields->addFieldToTab("Root.Main", CheckboxSetField::create($name = "Filters", $title = "Select filter categories", $source = $filters));
  7. }

... which allowed me to print $Filters in the template, but as it's a varchar in the db it the array as a string in the template:

  1. ["filter1","filter2"]

... my understanding is that I can't create an ArrayList in the $db, is that correct? And if so, could I change this approach to acheive the desired result of printing the undividual filters to the template?

SilentDesigns

@nightjarnz I'm thinking your pointing me towards using ::get() ?

SilentDesigns

Afternoon all. I have a function in my page.php file:

  1. public function myFilters() {
  2. $filters = array(
  3. "0" => "All",
  4. "1" => "Brand and identity",
  5. "2" => "Video and photography",
  6. "3" => "Advertising and comms",
  7. "4" => "Digital",
  8. "5" => "Spatial"
  9. );
  10. $filtersList = new ArrayList();
  11. foreach($filters as $filter) {
  12. $filtersList->push(
  13. new ArrayData(array('filter' => $filter))
  14. );
  15. }
  16. return $filtersList;
  17. }

.. that spits out an array of filters into the http://page.ss template:

  1. <% loop $myFilters %>$filter, <% end_loop %>

... I want to be able to allow the CMS user to update the filters array via a checkbox field. Something like:

  1. public function getCMSFields(){ ...
  2. $fields->addFieldToTab("Root.Main", CheckboxSetField::create($name = "Categories", $title = "Select filter categories", $source = $filters))
  3. ... }

How do I access/edit the $filters array inside the $myFilters function from getCMSFields()?

SilentDesigns

Morning all, and HNY. Desides the potential up-coming SS meetup(s) - does anyone know of any active digital/developer meetup/networking groups in Welly? http://Meetup.com has a few, but none seem to be particularly active right now.

SilentDesigns

Cool, thanks and then I need to run the MigrateFileTask ? Or just flush?

SilentDesigns

So is it a case of re-creating the old element with the old name and adding a use statement that points to the new element?