Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 53 additions & 1 deletion source/php/Component/Acceptance/Acceptance.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace ComponentLibrary\Component\Acceptance;

class Acceptance extends \ComponentLibrary\Component\BaseController
class Acceptance extends \ComponentLibrary\Component\BaseController implements AcceptanceInterface
{
//Indicated that there are exceptions of js behaviors in frontend
private $jsBehaviourSystemTypes = ['video'];
Expand Down Expand Up @@ -294,4 +294,56 @@ public function __construct(
$this->requiresAccept = $requiresAccept;
$this->systemType = $systemType;
}
// -------------------------------------------------------------------------
// ComponentInterface — generated getters
// -------------------------------------------------------------------------

public function getSlug(): string
{
return 'acceptance';
}

// -------------------------------------------------------------------------
// AcceptanceInterface — generated getters
// -------------------------------------------------------------------------

public function getLabels(): mixed
{
return $this->data['labels'] ?? false;
}

public function getHeight(): bool|string
{
return $this->data['height'] ?? false;
}

public function getSrc(): bool|array
{
return $this->data['src'] ?? false;
}

public function getPolicy(): bool
{
return $this->data['policy'] ?? false;
}

public function getHost(): bool
{
return $this->data['host'] ?? false;
}

public function getIcon(): string
{
return $this->data['icon'] ?? 'info';
}

public function getCover(): bool
{
return $this->data['cover'] ?? false;
}

public function getModifier(): string
{
return $this->data['modifier'] ?? '';
}
}
51 changes: 51 additions & 0 deletions source/php/Component/Acceptance/AcceptanceInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<?php

declare(strict_types=1);

namespace ComponentLibrary\Component\Acceptance;

use ComponentLibrary\Component\ComponentInterface;

interface AcceptanceInterface extends ComponentInterface
{
/**
* Object or array containing knownLabels and unknownLabels with title, info, and button.
*/
public function getLabels(): mixed;

/**
* height in number ex 500.
*/
public function getHeight(): bool|string;

/**
* array of urls to hide ex. https://www.youtube.com.
*/
public function getSrc(): bool|array;

/**
* URL to third party website policy.
*/
public function getPolicy(): bool;

/**
* host ex. youtube.com.
*/
public function getHost(): bool;

/**
* Icon name as a string.
*/
public function getIcon(): string;

/**
* URL for background image.
*/
public function getCover(): bool;

/**
* Modifier variable ex. video.
*/
public function getModifier(): string;

}
79 changes: 78 additions & 1 deletion source/php/Component/Accordion/Accordion.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Class Accordion
* @package ComponentLibrary\Component\Accordion
*/
class Accordion extends \ComponentLibrary\Component\BaseController
class Accordion extends \ComponentLibrary\Component\BaseController implements AccordionInterface
{
public function init() {
//Extract array for eazy access (fetch only)
Expand All @@ -20,4 +20,81 @@ public function init() {

$this->data['id'] = $this->sanitizeIdAttribute(uniqid());
}
// -------------------------------------------------------------------------
// ComponentInterface — generated getters
// -------------------------------------------------------------------------

public function getSlug(): string
{
return 'accordion';
}

// -------------------------------------------------------------------------
// AccordionInterface — generated getters
// -------------------------------------------------------------------------

public function getId(): string
{
return $this->data['id'] ?? '';
}

public function getList(): array
{
return $this->data['list'] ?? [];
}

public function getBeforeHeading(): string
{
return $this->data['beforeHeading'] ?? '';
}

public function getAfterHeading(): string
{
return $this->data['afterHeading'] ?? '';
}

public function getBeforeContent(): string
{
return $this->data['beforeContent'] ?? '<p>';
}

public function getAfterContent(): string
{
return $this->data['afterContent'] ?? '</p>';
}

public function getComponentElement(): string
{
return $this->data['componentElement'] ?? 'div';
}

public function getSectionElement(): string
{
return $this->data['sectionElement'] ?? 'div';
}

public function getSectionHeadingElement(): string
{
return $this->data['sectionHeadingElement'] ?? 'button';
}

public function getSectionContentElement(): string
{
return $this->data['sectionContentElement'] ?? 'div';
}

public function getSpacedSections(): bool
{
return $this->data['spacedSections'] ?? false;
}

public function getTaxonomy(): array
{
return $this->data['taxonomy'] ?? [];
}

public function getTaxonomyPosition(): string
{
return $this->data['taxonomyPosition'] ?? '';
}
}
76 changes: 76 additions & 0 deletions source/php/Component/Accordion/AccordionInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
<?php

declare(strict_types=1);

namespace ComponentLibrary\Component\Accordion;

use ComponentLibrary\Component\ComponentInterface;

interface AccordionInterface extends ComponentInterface
{
/**
* ID for the accordion.
*/
public function getId(): string;

/**
* List of accordion section.
*/
public function getList(): array;

/**
* Insert before heading.
*/
public function getBeforeHeading(): string;

/**
* Insert after heading.
*/
public function getAfterHeading(): string;

/**
* Insert before content.
*/
public function getBeforeContent(): string;

/**
* Insert after content.
*/
public function getAfterContent(): string;

/**
* Component element.
*/
public function getComponentElement(): string;

/**
* Section element.
*/
public function getSectionElement(): string;

/**
* Section heading component.
*/
public function getSectionHeadingElement(): string;

/**
* Section content component.
*/
public function getSectionContentElement(): string;

/**
* Sections are spaced instead of glued together.
*/
public function getSpacedSections(): bool;

/**
* Array of taxonomies such as tags.
*/
public function getTaxonomy(): array;

/**
* Taxonomy position like top or below.
*/
public function getTaxonomyPosition(): string;

}
74 changes: 73 additions & 1 deletion source/php/Component/Accordion__item/Accordion__item.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Class Accordion
* @package ComponentLibrary\Component\Accordion
*/
class Accordion__item extends \ComponentLibrary\Component\BaseController
class Accordion__item extends \ComponentLibrary\Component\BaseController implements Accordion__itemInterface
{
private $heading;

Expand All @@ -32,4 +32,76 @@ public function init() {
private function headingType($heading) {
return !empty($heading) && is_array($heading);
}
// -------------------------------------------------------------------------
// ComponentInterface — generated getters
// -------------------------------------------------------------------------

public function getSlug(): string
{
return 'accordion__item';
}

// -------------------------------------------------------------------------
// Accordion__itemInterface — generated getters
// -------------------------------------------------------------------------

public function getId(): string
{
return $this->data['id'] ?? '';
}

public function getHeading(): string|array
{
return $this->data['heading'] ?? '';
}

public function getBeforeHeading(): string
{
return $this->data['beforeHeading'] ?? '';
}

public function getAfterHeading(): string
{
return $this->data['afterHeading'] ?? '';
}

public function getBeforeContent(): string
{
return $this->data['beforeContent'] ?? '';
}

public function getAfterContent(): string
{
return $this->data['afterContent'] ?? '';
}

public function getSectionElement(): string
{
return $this->data['sectionElement'] ?? 'div';
}

public function getSectionHeadingElement(): string
{
return $this->data['sectionHeadingElement'] ?? 'a';
}

public function getSectionContentElement(): string
{
return $this->data['sectionContentElement'] ?? 'div';
}

public function getTaxonomy(): array
{
return $this->data['taxonomy'] ?? [];
}

public function getTaxonomyPosition(): string
{
return $this->data['taxonomyPosition'] ?? '';
}

public function getIcon(): string
{
return $this->data['icon'] ?? 'keyboard_arrow_down';
}
}
Loading