public function redirectByAction($actionName, $controller)
 {
     $url = \wpPluginFramework\WPHelper::getLinkForAction($this->core, $controller, $actionName);
     $this->redirect($url);
 }
<form name='EditBlock' method="post" action="<?php 
echo \wpPluginFramework\WPHelper::getLinkForAction($this->core, $this, 'actionEditBlock');
?>
">
    <label for="EditBlock[name]">Name: </label>
    <input type='text' name="EditBlock[name]" value="<?php 
echo $model->name;
?>
"/>
    <br/>

    <label for="EditBlock[content]'">Content: </label>
    <br/>
    <textarea name="EditBlock[content]" style='width:80%; height: 150px;'><?php 
echo $model->content;
?>
</textarea>
    <br/>

    <input type='hidden' name="id" value="<?php 
echo $model->_id;
?>
"/>

    <input type="submit" value="Apply changes" >
</form>
<form name='AddBlock' method="post" action="<?php 
echo \wpPluginFramework\WPHelper::getLinkForAction($this->core, __CLASS__, __METHOD__);
?>
">
    <label for="AddBlock[name]">Name: </label>
    <input type='text' name="AddBlock[name]" />
    <br/>

    <label for="AddBlock[content]'">Content: </label>
    <br/>
    <textarea name="AddBlock[content]" style='width:80%; height: 150px;'></textarea>
    <br/>

    <input type="submit" value="Add block" >
</form>
Exemple #4
0
        <th>Name</th>
        <th>Actions</th>
    </tr>
    </thead>
<?php 
foreach ($models as $model) {
    ?>
    <tr>
       <td style='width:50%'><?php 
    echo $model->name;
    ?>
</td>
       <td>
           <button onclick='location.href="<?php 
    echo \wpPluginFramework\WPHelper::getLinkForAction($this->core, $this, 'actionEditBlock') . '&id=' . $model->_id;
    ?>
"'>
               Edit block
           </button>
           <button onclick='location.href="<?php 
    echo \wpPluginFramework\WPHelper::getLinkForAction($this->core, $this, 'actionDeleteBlock') . '&id=' . $model->_id;
    ?>
"'>
               Delete block
           </button>
       </td>
    </tr>
<?php 
}
?>
</table>