<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.7 |
+ | CiviCRM version 5 |
+--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2016 |
+ | Copyright CiviCRM LLC (c) 2004-2018 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
/**
*
* @package CRM
- * @copyright CiviCRM LLC (c) 2004-2016
+ * @copyright CiviCRM LLC (c) 2004-2018
*/
/**
);
$this->add('text', 'url', ts('Url'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_Navigation', 'url'));
+
+ $this->add('text', 'icon', ts('Icon'), array('class' => 'crm-icon-picker', 'title' => ts('Choose Icon'), 'allowClear' => TRUE));
+
$permissions = array();
foreach (CRM_Core_Permission::basicPermissions(TRUE, TRUE) as $id => $vals) {
$permissions[] = array('id' => $id, 'label' => $vals[0], 'description' => (array) CRM_Utils_Array::value(1, $vals));
* @return array
*/
public function setDefaultValues() {
- $defaults = $this->_defaults;
+ $defaults = parent::setDefaultValues();
if (isset($this->_id)) {
//Take parent id in object variable to calculate the menu
//weight if menu parent id changed
$params['current_parent_id'] = $this->_currentParentID;
}
+ if (!empty($params['icon'])) {
+ $params['icon'] = 'crm-i ' . $params['icon'];
+ }
+
$navigation = CRM_Core_BAO_Navigation::add($params);
// also reset navigation