Example #1
0
 /**
  * Constructor
  */
 public function __construct($scope, $options, $allowed_hooks = array())
 {
     // Merge default options
     $this->default_options = array_merge($this->default_options, array('max' => 0, 'min' => 1, 'std' => array(), 'fieldsets' => array(), 'fields' => array(), 'depth' => 0, 'add_text' => __('Add', 'youxi'), 'edit_text' => __('Edit', 'youxi'), 'delete_text' => __('Delete', 'youxi'), 'preview_template' => false, 'confirm_delete' => __('Are you sure you want to remove this item?', 'youxi')));
     parent::__construct($scope, $options, $allowed_hooks);
     /* Construct the template fields */
     $fields = (array) $this->get_option('fields');
     $depth = $this->get_option('depth');
     $scope = "{$this->scope}[{$this->field_name}][{{ data.index_{$depth} }}]";
     $the_fields = array();
     foreach ($fields as $name => $atts) {
         if (isset($atts['type'])) {
             $options = array_merge(compact('name'), (array) $atts);
             /* Check for nested repeaters */
             if ('repeater' == $options['type']) {
                 $options['depth'] = $depth + 1;
             }
             /* Prevent a TinyMCE field added to the repeater */
             if ('richtext' == $options['type']) {
                 $options['type'] = 'textarea';
                 unset($options['tinymce']);
             }
             $field = Youxi_Form_Field::factory($scope, $options);
             if (is_a($field, 'Youxi_Form_Field')) {
                 $the_fields[$name] = $field;
             }
         }
     }
     $this->set_option('fields', $the_fields);
 }
Example #2
0
 /**
  * Constructor
  */
 public function __construct($scope, $options, $allowed_hooks = array())
 {
     // Merge default options
     $this->default_options = array_merge($this->default_options, array('tinymce' => array('editor_class' => 'youxi-tmce')));
     parent::__construct($scope, $options, $allowed_hooks);
     add_filter($this->get_ID_filter_name(), array($this, 'filter_the_ID'));
 }
Example #3
0
 /**
  * Constructor
  */
 public function __construct($scope, $options, $allowed_hooks = array())
 {
     // Merge default options
     $this->default_options = array_merge($this->default_options, array('mode' => 'css'));
     if (isset($options['mode'])) {
         if (!in_array($options['mode'], array('css', 'javascript'))) {
             unset($options['mode']);
         }
     }
     parent::__construct($scope, $options, $allowed_hooks);
 }
Example #4
0
 /**
  * Constructor.
  */
 public function __construct($scope, $options, $allowed_hooks = array())
 {
     // Merge default options
     $this->default_options = array_merge($this->default_options, array('multiple' => false, 'return_type' => 'id', 'return_url_size' => 'full', 'frame_title' => __('Choose Image(s)', 'youxi'), 'frame_btn_text' => __('Insert Image(s)', 'youxi')));
     if (isset($options['return_type'])) {
         if (!in_array($options['return_type'], array('url', 'attachment', 'id'))) {
             unset($options['return_type']);
         } else {
             if ('attachment' == $options['return_type']) {
                 $options['return_type'] = 'id';
             }
         }
     }
     parent::__construct($scope, $options, $allowed_hooks);
 }
 /**
  * Constructor
  */
 public function __construct($scope, $options, $allowed_hooks = array())
 {
     // Merge default options
     $this->default_options = array_merge($this->default_options, array('fieldsets' => array()));
     parent::__construct($scope, $options, $allowed_hooks);
     /* Construct the template fieldsets */
     $fieldsets = (array) $this->get_option('fieldsets');
     foreach ($fieldsets as $id => $fieldset) {
         if (!isset($fieldset['fields'])) {
             unset($fieldsets[$id]);
             continue;
         }
         foreach ((array) $fieldset['fields'] as $name => $atts) {
             if (isset($atts['type'])) {
                 $options = array_merge(compact('name'), (array) $atts);
                 $field = Youxi_Form_Field::factory("{$this->scope}[{$this->field_name}][{$id}]", $options);
                 if (is_a($field, 'Youxi_Form_Field')) {
                     $fieldsets[$id]['fields'][$name] = $field;
                 }
             }
         }
     }
     $this->set_option('fieldsets', $fieldsets);
 }
Example #6
0
 /**
  * Constructor.
  */
 public function __construct($scope, $options, $allowed_hooks = array())
 {
     // Merge default options
     $this->default_options = array_merge($this->default_options, array('inline' => true));
     parent::__construct($scope, $options, $allowed_hooks);
 }
Example #7
0
 /**
  * Constructor.
  */
 public function __construct($scope, $options, $allowed_hooks = array())
 {
     // Merge default options
     $this->default_options = array_merge($this->default_options, array('assets' => array(), 'choices' => array()));
     parent::__construct($scope, $options, $allowed_hooks);
 }
Example #8
0
 /**
  * Constructor.
  */
 public function __construct($scope, $options, $allowed_hooks = array())
 {
     // Merge default options
     $this->default_options = array_merge($this->default_options, array('std' => '#ffffff', 'palette' => true, 'hide' => true));
     parent::__construct($scope, $options, $allowed_hooks);
 }
Example #9
0
 /**
  * Constructor
  */
 public function __construct($scope, $options, $allowed_hooks = array())
 {
     // Merge default options
     $this->default_options = array_merge($this->default_options, array('frame_title' => __('Choose File', 'youxi'), 'frame_btn_text' => __('Insert File', 'youxi'), 'upload_btn_text' => __('Select File', 'youxi'), 'remove_btn_text' => __('Remove File', 'youxi'), 'always_return_url' => false, 'enable_embed' => true, 'library_type' => ''));
     parent::__construct($scope, $options, $allowed_hooks);
 }
Example #10
0
 /**
  * Constructor
  */
 public function __construct($scope, $options, $allowed_hooks = array())
 {
     // Merge default options
     $this->default_options = array_merge($this->default_options, array('columns' => false, 'min_columns' => 2, 'max_columns' => 10, 'rows' => false, 'min_rows' => 2, 'max_rows' => 0, 'mode' => 'textarea', 'textarea_rows' => 4));
     parent::__construct($scope, $options, $allowed_hooks);
 }
Example #11
0
 /**
  * Constructor.
  */
 public function __construct($scope, $options, $allowed_hooks = array())
 {
     // Merge default options
     $this->default_options = array_merge($this->default_options, array('inline' => true, 'uncheckable' => false, 'choices' => array()));
     parent::__construct($scope, $options, $allowed_hooks);
 }