1
votes

I am Trying to Convert Yii Jui timepicker extension into Yii2. But i am stacked at one method which is available in Yii but not in Yii2 called resolveNameID(). I Found that method at CinputWidget.

But this method not found in yii2-jui/InputWidget.

I am able to convert below method in Yii2 partially but don't know where to put them. May be in yii2-jui/InputWidget.php

resolveNameID() in Yii:

protected function resolveNameID()
{
   if($this->name!==null)
      $name=$this->name;
   elseif(isset($this->htmlOptions['name']))
      $name=$this->htmlOptions['name'];
   elseif($this->hasModel())
      $name=CHtml::activeName($this->model,$this->attribute);
   else
      throw new CException(Yii::t('yii','{class} must specify "model" and "attribute" or "name" property values.',array('{class}'=>get_class($this))));

   if(($id=$this->getId(false))===null)
   {
      if(isset($this->htmlOptions['id']))
          $id=$this->htmlOptions['id'];
      else
          $id=CHtml::getIdByName($name);
  }

    return array($name,$id);
  }

I want to convert above method into Yii2 or any alternate method for resolveNameID() in Yii2.

Thanks in Advance.

1
Why wont you use already existing and working extension: timepicker ?Glapa

1 Answers

0
votes

I think you should look at this doc for base helper

in detail look at getInputId()

Generates an appropriate input ID for the specified attribute name or expression.

and getInputName()

Generates an appropriate input name for the specified attribute name or expression.