Jump to content

HelperFieldLinks - field and template edit shortcuts


Soma
 Share

Recommended Posts

Ah yes the module inits on page edit screens.

I don't see any errors. DO you mean the array to string conversion notices martijn tells about?

The notices comes from the all the 'roles' arrays. I don't see them anywhere in the helper text (weird that they're bugging me). 

These are: editRoles, addRoles, createRoles & roles.

 

I changed the line 156 to this prevents the notices.

if(is_array($data_value)) $data_value = implode(" ", $data_value);
$settings_str .= "<h1>$data_key:</h1> $data_value<br/>";

I'm not seeing theses notices anywhere so wondering what PHP version you see them? For me it just output "Array" where there is a array in $data_value...

So that means my previous try to fix doesn't remove the notices?

Ah yes there still seems to be settings that are arrays. The editRoles etc are on template field not?
 
The fix you posted is simple but would just show the ids of the roles, and I would like to output title and links as with parent_id or template_id.
 
I will try to catch the roles also, hope that there's isn't much more. And leave a implode in there for those missing in case.
Link to comment
Share on other sites

Will see tonight if I have the time to debug.

I'm not very handy with that git stuff.

// start at line 160
if(in_array($data_key, array('editRoles', 'addRoles', 'createRoles', 'roles'))) {
	$array = $data_value;
	$data_value = '';
	foreach ($array as $id) $data_value .= $this->pages->get((int)$id)->name . ', ';
	$data_value = rtrim($data_value, ', ');
}

$settings_str .= "<span>$data_key:</span> $data_value<br/>";
Edited by Martijn Geerts
  • Like 2
Link to comment
Share on other sites

  • 2 weeks later...

Hey Martijn,

Thanks for taking the time to help sort this out. I applied your fix and it works for page editing, but there were still notices if editing anything under the Admin page. I have to admit I haven't spent the time to fully understand the module and your fix, but I have added the following to line 97 and it seems to take care of the other notices:

if(in_array($data_key, array('required', 'textformatters', 'size', 'maxlength', 'description', 'collapsed', 'required', 'moduleTypes'))) {
    $array = $data_value;
    $data_value = '';
    if(is_array($array)) foreach ($array as $id) $data_value .= $this->pages->get((int)$id)->name . ', ';
    $data_value = rtrim($data_value, ', ');
}

$settings_str .= "<span>$data_key:</span> $data_value<br/>";
 

Not sure if there are any side effects.

  • Like 1
Link to comment
Share on other sites

  • 1 month later...

Thanks Soma for this module. It's one of the biggest admin improvements I've seen. This really saves me a lot of time!! Congrats.

Btw, it's not showing the field names in the users template, isn't it? even though I've added custom fields. It would be useful there too. Just letting you know!

Link to comment
Share on other sites

  • 2 weeks later...

Sorry for the late reply, here is an example page:

Notice: Array to string conversion in /site/modules/HelperFieldLinks/HelperFieldLinks.module on line 155

Fields on that page used are of type: checkbox, select, range slider (from a module), text area, page, text, pagetitle...

Link to comment
Share on other sites

  • 4 weeks later...

I am pretty sure on 2.3 I was seeing an error when editing the Home page, I have moved to 2.4 and now the only place I have seen this error is when editing the Admin page:

Notice: Array to string conversion in /Users/alan/.../example.ca/live/site/modules/HelperFieldLinks/HelperFieldLinks.module on line 96

Not a problem for me at all, I just hope it was helpful to report it here and I am not missing something silly.

Link to comment
Share on other sites

  • 4 months later...
  • 1 year later...

Hey Soma,

I still install this module on every site and was thinking that a nice addition would be to convert the "send_templates" pipe separated list of IDs to a comma separated list of template labels/names.

Anyway, just a thought for when you're bored :)

Link to comment
Share on other sites

Tried to install this on dev 3.0.2 and got error: Class 'Wiredata' not found (line 21 of /Library/WebServer/Documents/pw/site/modules/HelperFieldLinks/HelperFieldLinks.module). 

Edit: The problem seems to be: the line has "extends Wiredata" and should have "extends WireData".

By the way, could this link be added to the title where on hover the name of the field is now shown, but is not a link to edit it. Or at least the style:

.fieldEditLink, .templateEditLink {

margin-top: 1em; 

could be less that 1em, even without margin-top. 

Edited by lpa
Link to comment
Share on other sites

  • 1 month later...
  • 3 weeks later...
  • 3 months later...

For a while now I run into the before-mentioned "Array to string conversion" issue on editing a page:
 

Notice: Array to string conversion in ..../site/assets/cache/FileCompiler/site/modules/HelperFieldLinks/HelperFieldLinks.module on line 166

		else if(is_array($data_value)){
			$data_value = implode("|",$data_value);
		}
		$settings_str .= "<span>$data_key:</span> $data_value<br/>";

It occurred in PW 3.0.18 and now in PW 3.0.20, too.

Link to comment
Share on other sites

For a while now I run into the before-mentioned "Array to string conversion" issue on editing a page:

Yeah, there a several posts about this if you look back through this thread, as well as a Github Issue (https://github.com/somatonic/HelperFieldLinks/issues/6) - sounds like Soma has had trouble reproducing, so maybe one of us needs to help out and put together a PR that fixes them all - anyone keen?

Link to comment
Share on other sites

  • 1 year later...

I have always liked this module, but now found out that using this together with AdminPageFieldEditLinks-module there is a problem with the links alignments. I don't know which one should be fixed, though. 

Normal view:

normal-view.png.9d566098e3d7bc9ca77c827412320541.png

Broken view:

broken-view.png.13183f3fc6648652286a41b59864c322.png

Link to comment
Share on other sites

  • 2 years later...
  • 2 months later...

Good day @Soma!

Great module! I've been using it forever and can't live without it. When I login to any site without it installed, I feel kind of helpless for a while)

My problem is it does not show the link for the RepeaterMatrix fields. Not an error like in the post above, but nothing at all. Could you please check? Created a github issue for this too.

Edit: Sorry for incomplete report. The link is there, when all the items are collapsed. But if the "Remember, which repeater items are open?" option is checked, and one of the items is expanded on page load, the link is gone.

Link to comment
Share on other sites

  • 1 year later...

Hi there, you who are using this module might be interested in a new module I created AdminHelperLinks. It has the same purpose but uses different approach. I don't want to steal @Soma's reputation, but he seems inactive in developing the module and I realized while trying to fix the bugs I can do it differently (using JS instead of PHP) and more meeting my needs.

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...