コード例 #1
0
ファイル: Action.php プロジェクト: joshbruce/sam-uikit-php
 public static function build($config)
 {
     $type = $config['type'];
     $target = $config['target'];
     $createTitle = isset($config['createTitle']) ? $config['createTitle'] : null;
     if ($type == 'create' && is_null($createTitle)) {
         dd('Action component not configured properly - create requires title');
     }
     $string = '';
     if ($type == 'create') {
         $string .= '<a href="' . $target . '">';
         $string .= Label::build(['title' => 'New ' . $createTitle, 'icon' => 'create', 'moreClass' => 'usa-action-horizontal']);
         $string .= '</a>';
     } elseif (array_key_exists($type, Action::icons())) {
         if ($type == 'delete') {
             $string .= '<div class="usa-action-container delete">';
         } else {
             $string .= '<div class="usa-action-container">';
         }
         $string .= '<span><a href="' . $target . '">';
         $string .= Icon::build($type);
         $string .= ucfirst($type);
         $string .= '</a>';
         $string .= '</span>';
         $string .= '</div>';
     }
     return $string;
 }
コード例 #2
0
ファイル: Other.php プロジェクト: joshbruce/sam-uikit-php
 /**
  * To allow the greatest flexibility in the definition of this element,
  * a keyed array is passed.
  *
  * Required keys
  * * **type:** See Icon.
  * * **target:** Anchor href target for the cancel link.
  *
  * Create type required keys
  * * **createTitle:** Required if type is "create".
  * 
  * @param  [type] $config Array of key-value pairs.
  * @return [type]        [description]
  */
 public static function action($config)
 {
     return Action::build($config);
 }