Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
colintucker committed Nov 3, 2017
2 parents 9b2c966 + ec6f468 commit cecbf61
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 0 deletions.
34 changes: 34 additions & 0 deletions src/Backends/FontAwesomeBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,40 @@ public function getClassName($identifier, $args = [])
}
}

/**
* Answers an associative array of icon IDs mapped to icon names.
*
* @return array
*/
public function getIcons()
{
// Initialise:

$icons = [];

// Iterate Grouped Icons:

foreach ($this->getGroupedIcons() as $name => $group) {

foreach ($group as $id => $icon) {

if (!isset($icons[$id])) {
$icons[$id] = isset($icon['name']) ? $icon['name'] : $id;
}

}

}

// Sort Icons by Key:

ksort($icons);

// Answer Icons:

return $icons;
}

/**
* Answers an array of icons grouped into their respective categories.
*
Expand Down
18 changes: 18 additions & 0 deletions src/Forms/FontIconField.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,24 @@ public function Type()
return sprintf('fonticonfield %s', parent::Type());
}

/**
* Answers the source items for the field.
*
* @return array|ArrayAccess
*/
public function getSource()
{
// Answer Custom Source:

if ($source = $this->source) {
return $source;
}

// Answer Default Source:

return $this->backend->getIcons();
}

/**
* Answers an HTTP response containing JSON results matching the given search parameters.
*
Expand Down
7 changes: 7 additions & 0 deletions src/Interfaces/FontIconBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,13 @@ public function getTag($classNames);
*/
public function getClassName($identifier, $args = []);

/**
* Answers an associative array of icon IDs mapped to icon names.
*
* @return array
*/
public function getIcons();

/**
* Answers an array of icons grouped into their respective categories.
*
Expand Down

0 comments on commit cecbf61

Please sign in to comment.