fromConfig() public static method

Build the filter from configuration
public static fromConfig ( array $motifs = [] ) : self
$motifs array
return self
コード例 #1
0
ファイル: Motifs.php プロジェクト: paragonie/airship
 /**
  * @route motifs/{string}
  *
  * @param string $cabinName
  */
 public function manage(string $cabinName = '')
 {
     $cabins = $this->getCabinNamespaces();
     if (!\in_array($cabinName, $cabins)) {
         \Airship\redirect($this->airship_cabin_prefix . '/motifs');
     }
     if (!$this->can('update')) {
         \Airship\redirect($this->airship_cabin_prefix . '/motifs');
     }
     $motifs = \Airship\loadJSON(ROOT . '/Cabin/' . $cabinName . '/config/motifs.json');
     $post = $this->post(MotifsFilter::fromConfig(\array_keys($motifs)));
     if ($post) {
         if ($this->updateMotifs($motifs, $post, $cabinName)) {
             \Airship\clear_cache();
             \Airship\redirect($this->airship_cabin_prefix . '/motifs/cabin/' . $cabinName);
         }
     }
     $this->lens('motif_manage', ['cabin_name' => $cabinName, 'cabins' => $cabins, 'motifs' => $motifs, 'title' => \__('Motifs for %s', 'default', Util::noHTML($cabinName))]);
 }