Caffeinated\Menus\Builder::extractAttributes PHP Method

extractAttributes() public method

Extract the valid attributes from the passed options.
public extractAttributes ( array $options = [] ) : array
$options array
return array
    public function extractAttributes($options = array())
    {
        if (is_array($options)) {
            if (count($this->groupStack) > 0) {
                $options = $this->mergeWithLastGroup($options);
            }
            return array_except($options, $this->reserved);
        }
        return array();
    }

Usage Example

コード例 #1
0
ファイル: Item.php プロジェクト: tok3/menus
 /**
  * Constructor.
  *
  * @param  \Caffeinated\Menus\Builder  $builder
  * @param  int                        $id
  * @param  string                     $title
  * @param  array|string               $options
  */
 public function __construct($builder, $id, $title, $options)
 {
     $this->builder = $builder;
     $this->id = $id;
     $this->title = $title;
     $this->slug = camel_case(str_slug($title, ' '));
     $this->attributes = $this->builder->extractAttributes($options);
     $this->parent = (is_array($options) and isset($options['parent'])) ? $options['parent'] : null;
     $this->configureLink($options);
 }