• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • Examples
  • File List

system/controls/formcontrolrepeater.php

00001 <?php
00002 
00003 namespace Habari;
00004 
00008 class FormControlRepeater extends FormContainer
00009 {
00013   public function _extend()
00014   {
00015     $this->set_settings(array(
00016       'ignore_name' => true,
00017       'process' => false,
00018     ));
00019   }
00020 
00026   public function get(Theme $theme)
00027   {
00028     $this->vars['element'] = $this->get_setting('wrap_element', 'div');
00029 
00030     $content = '';
00031 
00032     foreach($this->value as $key => $data) {
00033       // Push the $key of this array item into the control's name
00034       $this->each(function(FormControl $control) use($key) {
00035         $control->add_input_array($key);
00036       });
00037 
00038       $content .= $this->get_contents($theme);
00039 
00040       // Pop the key of this array item out of the control's name
00041       $this->each(function(FormControl $control) {
00042         $control->pop_input_array();
00043       });
00044     }
00045 
00046     $this->vars['content'] = $content;
00047 
00048     return FormControl::get($theme);
00049   }
00050 }
00051 
00052 ?>

Generated on Sun Aug 4 2013 12:51:43 for Habari by  doxygen 1.7.1