예제 #1
0
 /**
  * Component constructor.
  * 
  * @param     mixed[] $model    The component's model data.
  * @throws    RequiredParameterException If user did not provide a required
  *            parameter as specified in ComponentInterface::required_parameters()
  */
 public function __construct(array $model)
 {
     parent::__construct($model);
     // Check that the required parameters are provided.
     foreach ($this->required_parameters() as $key) {
         if (!$model[$key]) {
             throw new RequiredParameterException('The required parameter "' . $key . '" was not provided for ' . get_called_class());
         }
     }
 }
예제 #2
0
 /**
  * Option page section.
  * 
  * @param array $model
  * <ul>
  *      <li>[title] <i>string</i> The section's title. MUST be unique.</li>
  *      <li>[description] <i>string</i> The section's description.</li>
  *      <li>[icon] <i>string</i> One of the icon classes from Font Awesome or Dashicons.</li>
  *      <li>[parent] <i>string</i> The parent's title, if applicable.</li>
  *      <li>[fields] <i>array</i> The section's fields.</li>
  *      <li>[subsections] <i>array</i> An array holding subsections, each of which has a title and an array of fields. If this parameter is provided, the 'fields' parameter is ignored</li>
  * </ul>
  */
 public function __construct(array $model = array())
 {
     parent::__construct($model);
 }