當前位置: 首頁>>代碼示例>>PHP>>正文


PHP JModelList::setState方法代碼示例

本文整理匯總了PHP中JModelList::setState方法的典型用法代碼示例。如果您正苦於以下問題:PHP JModelList::setState方法的具體用法?PHP JModelList::setState怎麽用?PHP JModelList::setState使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在JModelList的用法示例。


在下文中一共展示了JModelList::setState方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: testListInfoIsAppendedToFormData

 /**
  * Tests the loadFormData method.
  *
  * @since   3.4
  *
  * @return  void
  *
  * @testdox loadFormData() returns correct data from currently set states
  */
 public function testListInfoIsAppendedToFormData()
 {
     $method = new ReflectionMethod('JModelList', 'loadFormData');
     $method->setAccessible(true);
     $applicationMock = $this->getMockCmsApp();
     $applicationMock->expects($this->once())->method('getUserState')->with($this->equalTo('com_j.list'), $this->equalTo(new stdClass()))->will($this->returnValue((object) array("foo" => "bar")));
     JFactory::$application = $applicationMock;
     $this->object->setState('list.direction', 'ASC');
     $this->object->setState('list.limit', 30);
     $this->object->setState('list.ordering', 'enabled');
     $this->object->setState('list.start', 0);
     $expected = (object) array("foo" => "bar", "list" => array('direction' => 'ASC', 'limit' => 30, 'ordering' => 'enabled', 'start' => 0));
     $this->assertEquals($expected, $method->invoke($this->object));
 }
開發者ID:SysBind,項目名稱:joomla-cms,代碼行數:23,代碼來源:JModelListTest.php

示例2: setState

 /**
  * Method to set model state variables. Update local vars.
  *
  * @access	public
  * @param	string	$property	The name of the property.
  * @param	mixed	$value	The value of the property to set or null.
  *
  * @return	mixed	The previous value of the property or null if not set.
  *
  * @since	11.1
  */
 public function setState($property, $value = null)
 {
     if ($property == 'context') {
         $this->context = $value;
     }
     return parent::setState($property, $value);
 }
開發者ID:gwtrains,項目名稱:comRTiPrint,代碼行數:18,代碼來源:list.php


注:本文中的JModelList::setState方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。