october-widgets / library Goto Github PK
View Code? Open in Web Editor NEWOctober Widget Library
October Widget Library
Sorry, this is repost issue that previously sent on october-widgets/hasmany.
So, is it possible to use hasmany widget for belongsToMany relationship?
Thanks
Hey Scott, take a look here, feel free to grab it to OWL: https://github.com/keiosweb/oc-knob-formwidget
does not seems to find any avaialble version with composer update.
any ideas please ?
HI,
It's possible to make a form widget for Polymorphic relations ?
I have a Model "Event" used to create a calendar with dates...
And I have several Models who morph one OR many Event ( Like a Todo Model for my exemple, it morphOne to Event)
I try to modify owl-hasMany but I can't get the Todo[Event[my_field]] when form is posting.
My EventableOne was the MorphOne Form widget who render the relation field on the form:
/**
* FormWidget for MorphOne Event
*/
class EventableOne extends FormWidgetBase
{
public $relatedModel;
public function widgetDetails()
{
return [
'name' => 'EventableRelation',
'description' => 'Form widget to manage eventable relationship'
];
}
protected $defaultAlias = 'eventableone';
public function init()
{
$this->relatedModel = new $this->model->morphOne[$this->fieldName][0];
}
public function render()
{
$this->prepareVars();
return $this->makePartial('eventableone');
}
/**
* Prepares the form widget view data
*/
public function prepareVars(){
$this->vars['alias'] = $this->alias;
// Load relationship for widget
$relationship = $this->loadRelationship();
$relationship->model = new Event(); // Init the model
$formWidget = $this->makeWidget('Backend\Widgets\Form', $relationship); // Make widget
$modelFormClassBase = class_basename(get_class($this->model));
$modelRelationClassBase = class_basename(get_class($formWidget->model));
$this->vars['formWidget'] = $formWidget;
$formWidget->bindToController(); // Bind Model to controller
$this->vars['default'] = isset($this->config->default);
}
private function loadRelationship(){
// Explode model path for determining plugin path
$fieldName = $this->fieldName;
// Get the model name if multiple or single mode
$parts = explode('\\', strtolower($this->model->morphOne[$fieldName][0]));
// Load relationship model, and configure the widget
$relationship = $this->makeConfig("@/plugins/$parts[0]/$parts[1]/models/$parts[3]/fields.yaml");
$relationship->model = $this->relatedModel;
$relationship->alias = $this->alias.$fieldName;
// Load form header
if (isset($this->config->formLabel))
$this->vars['formLabel'] = htmlspecialchars($this->config->formLabel);
else {
$modelName = explode('\\', get_class($this->relatedModel));
$this->vars['formLabel'] = end($modelName);
}
return $relationship;
}
fields.yaml on models/todo :
events:
label: Events
type: eventableone
Thank's for the help
Your regex in your example for alphanumeric filters does not work.
Using something like filter: "[^a-zA-Z0-9]+"
seems to work. But even better is filter: "[^a-zA-Z0-9_.-]+"
(alphanumeric and dashes/underscores).
This is caused by pre-existing data in the database for a field... if $loadValue
(https://github.com/october-widgets/tagbox/blob/master/Widget.php#L77) is null.
Should probably do a check if($loadValue)
first.
Invalid argument supplied for foreach()
C:\xamppPHP55\htdocs\oca-forms\plugins\oca\webforms\vendor\owl\tagbox\Widget.php line 78
The list is a quite nifty thing to have,but sometimes a pictures says more than a thousand words. Would it be possible to include a screenshot of the functionality in each repo?
Select2 (https://select2.github.io) is in october by default so this should probably be used for tagbox.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.