Jump to content

profields page table "count()" error when editing field


neosin
 Share

Recommended Posts

I see this frequently when editing existing PageTable fields within a template (in modal) and also directly in setup>fields>pagefield_name

Quote

Warning: count(): Parameter must be an array or an object that implements Countable in F:\htdocs\pw3098\wire\modules\Fieldtype\FieldtypePageTable.module on line 278

this function seems to be the culprit

	/**
	 * Get the Inputfield used for input by PageTable
	 * 
	 * @param Page $page
	 * @param Field $field
	 * @return Inputfield
	 * 
	 */
	public function getInputfield(Page $page, Field $field) {
		$inputfield = $this->modules->get('InputfieldPageTable');
		$value = $page->getUnformatted($field->name); 
		$inputfield->attr('value', $value);
		$templateID = $field->template_id;
		
		if(!$field->parent_id && !empty($templateID) && $page->numChildren > count($value)) {
			$orphans = $this->findOrphans($page, $field); 
			if(count($orphans)) $inputfield->setOrphans($orphans); 
		}
		
		return $inputfield; 
	}

 

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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...