/** * Get an array of the form element attributes for this column. * * @return array */ public function getFormElementAttributes(){ $na = parent::getFormElementAttributes(); $na['options'] = ['yes' => t('STRING_YES'), 'no' => t('STRING_NO')]; return $na; }
/** * Get an array of the form element attributes for this column. * * @return array */ public function getFormElementAttributes(){ if($this->formAttributes['type'] == 'datetime'){ $defaults = [ 'datetimepicker_dateformat' => 'yy-mm-dd', 'datetimepicker_timeformat' => 'HH:mm', 'displayformat' => 'Y-m-d H:i', 'saveformat' => 'U', ]; } else{ $defaults = []; } $na = parent::getFormElementAttributes(); return array_merge($defaults, $na); }
/** * Get an array of the form element attributes for this column. * * @return array */ public function getFormElementAttributes(){ $na = parent::getFormElementAttributes(); // Add special functionality here to allow passing in "this" as a valid reference for the "source" attribute. // This will allow the instantiated Model object as a whole to be used as a reference when retrieving options. if(isset($na['source'])){ if(strpos($na['source'], 'this::') === 0){ $na['source'] = [$this->parent, substr($na['source'], 6)]; } } elseif(!isset($na['options'])){ $opts = $this->options; if($this->null){ $opts = array_merge(['' => '-- Select One --'], $opts); } $na['options'] = $opts; } return $na; }