- This topic has 4 replies, 2 voices, and was last updated 6 years, 1 month ago by
claude.
-
AuthorPosts
-
-
January 5, 2016 at 11:56 am #5482
claudeMemberHi all,
I’m working on my personal WordPress site and hope to scale up to e-commerce support shortly. At the moment, I’m working in my local development environment and experimenting with Piklist. For reference, I’ve been developing software for about 35 years and was recently a principal architect at Microsoft.
I’ve read through all the Piklist documentation, more than once. A few things I think are missing and would make things easier for newcomers include the following:
* The life-cycle is a little unclear. I am assuming that the main Piklist plugin scans directories (or looks for something in memory) searching for the ‘Plugin Type: Piklist’ tag. What happens if you have multiple plugins in your (plugin) project? I presume this scanning/registration event would only happen once?
* I had a very difficult time finding the widget interface in the admin UI. On my system it appears blank (see attached screenshot). I presume there is something wrong here but there are no errors in the log. Selecting the widget in the pull down on the right does not cause errors but I don’t see anything on the site, and the other widgets in the same sidebar are visible (implying there are no errors that block processing). My parts directory hiearachy only has entries in the widgets subdirectory, essentially a renamed version of basic.php and basic-form.php with the first three fields taken from the demo (I’m removing things until I can figure out what it takes to get to a minimum working but state).
I’d like to contribute to the community conversation (and eventually provide a 5 star rating, as you often request I see 🙂 as I think the framework is well-designed and should save on considerable effort. I’ll post more as questions arise. Any clarification for the two points above would be appreciated.
Attachments:
You must be logged in to view attached files. -
January 5, 2016 at 12:08 pm #5484
claudeMemberFollow up: I am able to see the output from the widget. Some kind of caching problem maybe? The two points I raised are still worth asking about and I would love to hear about the plugin life-cycle and whether the blank widget view in WordPress admin is a known issue.
PS: I hope my mention of experience in the post is not take as arrogant. I find it helpful to know what a developer’s experience is when trying to explain things myself and figured this would provide some context to anyone who responds.
-
January 5, 2016 at 5:47 pm #5489
SteveKeymaster@claude– Welcome to the Piklist community!
1) Not exactly sure what you mean by “life-cycle”, since your question seems to pertain to load time. Just like every WordPress plugin, they all get scanned on every page load (with the exception of caching). So Piklist will also look for
Plugin Type: Piklistin the comment block of all plugins.2) The empty widget title is not a known issue. Glad it was resolved.
Also, we recommend that you use the latest beta version. It’s more stable and feature-rich then the current version on WordPress.org.
Let us know if you have any other questions.
-
January 5, 2016 at 5:58 pm #5492
claudeMemberHey Steve, thanks for responding.
Re: 1 – By life-cycle, I just mean what loads in what order and what gets checked in what sequence. That may be too broad a request for clarification but I think it could be a useful addition to the documentation since integration points (actions/filters, other events) are hit at different stages of the life-cycle. Based on your response, it sounds like it doesn’t matter how many plugins exist with Plugin Type: headers.
Re: 2 – The empty widget at run-time has been resolved and was something on my end but the blank widget in the admin editor, as per the screen shot is not. I would have expected the default view to be something that identifies the drag-able box as a Piklist widget and once a selection has been made from the pull-down a label that identifies the specific widget selected. It is simply white with the drop-down icon and so it took me quite a bit of time to realize that it was in fact the piklist widget after all.
-
January 5, 2016 at 6:10 pm #5493
claudeMemberI presume if I just overwrite the plugin directory with the beta zip that will be sufficient to upgrade?
BTW: When I assimilate new technologies I tend to write a few simple utilities that make it easier to express some central concepts. This helps me work through the details more deeply than I would otherwise and provides some basic tools I might use if I find them practical, so The first thing I wrote was a FieldBuilder that uses the fluent builder pattern. I’ll flesh this out and probably write a blog about it.
Usage follows this approach, where the first example uses the build call to get a constructed array and the second uses some shortcuts for common use cases.
$field1 = CDEFieldBuilder::create('text') ->name('cde_test') ->label('Test field') ->value('Value') ->description('Description text') ->help('Help text') ->attr('class', 'text') ->build(); piklist('field', $field1); CDEFieldBuilder::select('cde_select', 'Select field', 'option2') ->hints('Description and help text') ->choice('option1', "Value 1") ->choice('option2', "Value 2") ->choice('option3', "Value 3") ->field();I’m still debating whether the first case is actually more compact than the array declarations but the second certainly is. (hints uses a single value as both the description and help text, a lazy way of quickly prototyping, but it takes two parameters as well. I find this slightly easier to read.
The builder code is simple and looks like this:
class CDEFieldBuilder { private $building = array(); function __construct($type) { $this->building['type'] = $type; } // STATIC CREATION public static function create($type) { return new CDEFieldBuilder($type); } public static function text($name, $label, $value = '') { return CDEFieldBuilder::create('text')->common($name, $label, $value); } public static function select($name, $label, $value = '') { return CDEFieldBuilder::create('select')->common($name, $label, $value); } // FLUENT ATTRIBUTES public function name($name) { $this->building['field'] = $name; return $this; } public function label($label) { $this->building['label'] = $label; return $this; } public function value($value) { $this->building['value'] = $value; return $this; } // Combine the most common properties public function common($name, $label, $value = '') { $this->building['field'] = $name; $this->building['label'] = $label; $this->building['value'] = $value; return $this; } public function description($description) { $this->building['description'] = $description; return $this; } public function help($help) { $this->building['help'] = $help; return $this; } // Combine description and help (same if only one provided) public function hints($description, $help = NULL) { if ($help == NULL) { $help = $description; } $this->building['description'] = $description; $this->building['help'] = $help; return $this; } public function attributes($attributes) { $this->building['attributes'] = $attributes; return $this; } // ADD SINGLE ATTRIBUTE public function attr($name, $value) { if (!isset($this->building['attributes'])) { $this->building['attributes'] = array(); } $this->building['attributes'][$name] = $value; return $this; } // ADD SINGLE CHOICE public function choice($name, $value) { if (!isset($this->building['choices'])) { $this->building['choices'] = array(); } $this->building['choices'][$name] = $value; return $this; } // GET BUILT ARRAY OR ADD IT AS A PIKLIST FIELD public function build() { return $this->building; } public function field() { return piklist('field', $this->building); } }
-
-
AuthorPosts
- You must be logged in to reply to this topic.