This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Drupal\sps\Condition; | |
interface ConditionInterface { | |
/** | |
* Provide the config to allow this Condition to construct itself. | |
* | |
* @param $config | |
* An associative array of configuration, generally provided by the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//Basic condition should construct the correct widget and properly get its form | |
$test_widget = new \Drupal\sps\Test\Widget(array(), $manager); | |
$state = array(); | |
$widget = $test_widget->getPreviewForm(array(), $state); | |
$state = array(); | |
$element = $condition->getElement(array(), $state); | |
$this->assertEqual($subelement, $widget, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Passthrough from Drupal form to the correct condition for building the preview form | |
* | |
* @param $form | |
* The form array used in hook_form | |
* @param $form_state | |
* The form_state array as used in hook_form | |
* | |
* @return |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Passthrough from Drupal form to the correct condition for building the preview form | |
* | |
* @param $form | |
* The form array used in hook_form | |
* @param $form_state | |
* The form_state array as used in hook_form | |
* | |
* @return |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Helper method for getting and causing the root Condition | |
* | |
* The Root condition is the use as the basis for the constructing the preview form | |
* It can be expect that it will be much more complicated then the other conditions | |
* | |
* This method select the condition and its config using the config controller. | |
* | |
* @return \Drupal\sps\Plugins\ConditionInterface | |
* the current root condition object |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Implements ConditionInterface::getElement(). | |
* | |
* Gets the form for the condition. | |
* | |
* @see sps_condition_form_validate_callback | |
* @see sps_condition_form_submit_callback | |
*/ | |
public function getElement($element, &$form_state) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Passthrough from Drupal form to the correct condition for building the preview form | |
* | |
* @param $form | |
* The form array used in hook_form | |
* @param $form_state | |
* The form_state array as used in hook_form | |
* | |
* @return |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Fake enables a module for the purpose of a unit test | |
* | |
* @param $name | |
* The module's machine name (i.e. ctools not Chaos Tools) | |
*/ | |
protected function enableModule($name) { | |
$modules = module_list(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Implements WidgetInterface::getPreviewForm(). | |
* | |
* Return a form to collect the date information from the user. | |
*/ | |
public function getPreviewForm($element, &$form_state) { | |
$element['#type'] = 'fieldset'; | |
$element['#title'] = empty($this->settings['title']) ? t('Date/Time:') : $this->settings['title']; | |
$element['#description']= t('Preview nodes published on or after this date.'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$render = array(); | |
//Good | |
$render['top'] = array( | |
'#type' => 'items_list', | |
'#items' => array( | |
array('#data' => 'lololol'), | |
), |
OlderNewer