• Content count

  • Joined

  • Last visited

  • Days Won


kixe last won the day on June 4 2017

kixe had the most liked content!

Community Reputation

837 Excellent

About kixe

  • Rank
    Hero Member

Contact Methods

  • Website URL

Profile Information

  • Gender
  • Location
    Cologne, Germany
  1. Put the code I have posted in your ready.php and replace $this with $wire. $wire->addHookBefore('PagefilesManager::path', function ($e) { $e->replace = true; $e->return = null; });
  2. Please post your code or explain exactly what you are doing.
  3. This is an old issue. I use the following workaround. In case of an unsaved page instance (id = 0) a hook is called from the render() method of my custom module, which provides a form (withfile field) based on a PW template in the frontend: $this->addHookBefore('PagefilesManager::path', function ($e) { $e->replace = true; $e->return = null; });
  4. You need to enable 'modal' in module JqueryUI Don't set the href attribute. In this case the button will be wrapped by an anchor tag and you will be redirected to the url which you want to open in the modal. Use 'data-href' instead. If you set the property 'aclass' a class attribute value will be added to the anchor wrapper not to the button itself. Use function addClass() instead. Try this: wire('modules')->get('JqueryUI')->use('modal'); $btnAddNew = wire('modules')->get("InputfieldButton"); $btnAddNew->attr('data-href', wire('config')->urls->admin."page/add/?parent_id=1101&modal=1"); $btnAddNew->attr('id', "MyCustomAddPageButton"); // required for the additional button on top $btnAddNew->showInHeader(); $btnAddNew->addClass("pw-modal");
  5. @titanium Sorry for the extremely delayed answer. Thanks for pointing on this. I pushed an update which allows to use InputfieldColor as a config field for modules. I have made some changes in the code you have posted and tested it within the following module. Everything seems to work. Please check out. <?php namespace ProcessWire; class My2Module extends WireData implements Module, ConfigurableModule { /** * * @return array * */ public static function getModuleInfo() { return array( 'title' => 'My2Module', 'summary' => 'Module with Config Input of type Color', 'version' => 100 ); } static public function getDefaultConfig() { return array( 'color' => '#ff3300' ); } public function __construct() { foreach(self::getDefaultConfig() as $key => $value) { $this->$key = $value; } } /** * Initialize, attach hooks * */ public function init() { // ... } /** * module settings * */ static public function getModuleConfigInputfields(array $data) { $fields = new InputfieldWrapper(); $defaults = self::getDefaultConfig(); $data = array_merge($defaults, $data); $colors = [ 'name' => 'color', 'inputType' => 3, 'type' => 'color', // will search for 'InputfieldColor' // 'outputFormat' => 3, // REMOVED outputFormat is related to the Fieldtype and not to the Inputfield // 'defaultValue' => '#ff0080ff', // REMOVED @see getDefaultConfig() and __construct() // 'alpha' => 0, // REMOVED related to 'inputType=4', otherwise automatically set by the Inputfield 'spectrum' => "showInput: true\nallowEmpty:true\nshowAlpha: true\nshowInitial: true\nchooseText: \"Alright\"\ncancelText: \"No way\"\npreferredFormat: \"hex3\"", // 'class' => 'FieldtypeColor', // REMOVED (unnecessary) 'label' => __('Label'), 'description' => __('Description'), 'required' => false, 'value' => $data['color'], 'notes' => __('Initial value: '.$defaults['color']), ]; $fields->add($colors); return $fields; } }
  6. $pages->find() return a PageArray. Using echo PageArrays always return a string of the Page IDs separated by pipe "|" characters. Since you are looking for a single page you may want to use $pages->get(). To get the title of the page use $pages->get()->title. $pages$tags = explode(',', $page->tags); foreach ($tags as $tag) { $tag = trim($tag); echo $pages->get("tags=$tag")->title; }
  7. ... and don't forget to read this
  8. ProcessWire is even more, it has capabilities to be a conventional CMS with highly configurable Administration Interfaces, Templatesystem, Database Mangement/ Access and render tools for the output of dynamic markup headless CMS providing content data via API (JSON, GraphQL) and optionally static HTML + JavaScript (HUGO/ Jekyll) WAF (Web Application Framework) a platform to build a headless CMS or other App/ SaaS on top of fit Make your choice!
  9. The task is to change a runtime property (visibility) of a field and setting/saving a page field value if certain conditions are met. Hooks are great but not needed to solve this task.
  10. /** * check & hide specific checkbox field if page being edited has no children */ if ($page->process == 'ProcessPageEdit' && $input->id) { $field = $fields->get('createevents'); $_page = $pages->get($input->id); if ($_page->template->fields->hasField('createevents')) { if ($page->hasChildren() == false) { $field->set('flags',160); $field->setRoles('edit',array()); // works for non superuser only $_page->setAndSave('createevents', true); } } }
  11. @kongondo $this inside any template file will return the TemplateFile object and inside ready.php the ProcessWire object. @Juergen If you need to disable fields for certain roles or make them view only take this as a starting point. Put the code in your ready.php foreach ($fields as $field) { if ($field->hasFlag(8) && $field->name !== 'title') continue; // skip system fields `Field::flagSystem` $field->addFlag(160); // Add flags `Field::flagAccess` = 32 + `Field::flagAccessEditor` = 128 // Applicable only if the `Field::flagAccess` is set to this field's flags. $field->editRoles = array(); // leave empty if you want to give access to superuser only $field->viewRoles = array(1026); // assign field view permission to specific roles (IDs) // save the field $field->save(); }
  12. Does the customer have view permission for template: shop-order? If not, try to add check_access=0 to your selector string. // Get the orders $orders = wire('pages')->find("template=shop-order, order_user_id=$customer, sort=-datetime, limit=10, check_access=0, include=all");
  13. @Karl_T I fixed this too but without publishing here. Sorry for this Furthermore I added options for the label etc. In the environments I use it (latest PW) everything works as expected, even single select. I forked now the original module and pushed my latest version on github.
  14. Small CSS Border (left) issue using UIKit AdminTheme
  15. This is a translatable string. Not a message.