How can I use a SharePoint lookup value in a Calculated field?

I found the solution using a Power Automate flow. The image below does the following…

1 – The flow triggers whenever a list item is created or modified.

2 – Initialise variable #1 and copy the value from the lookup field.

3 – Initialise variable #2 and copy the value from the field which will hold the copy of the lookup value (which will be a hidden column and is only used for concatenation purposes)

4 – Test if variable #1 is different from variable #2. This is to prevent the flow from going into an infinite loop i.e. without it the flow would always modify the list item, and therefore trigger itself again. So if it’s the same, do nothing.

5 – If variables #1 and #2 are different, update the list item and copy the value from variable #1 into the field which will store the variable #1 value.

After that my calculated field uses the contents of that hidden column which I copied the lookup value into.

Hope this helps someone.

entities – How do I make a custom multi-checkboxes field?

By following the tutorials and documentation I am able to create a custom field that supports a single string value. However what I’d like to accomplish is a custom list (preferably the `checkboxes` type) where a user can select different options. I tried looking in core/modules/options schema.yml and copying the storage settings still gives me the same results. I get the error `This value should be of the correct primitive type.`

These are what I believe are the relevant chunks of code I currently have:

in fieldtype/

``````  public static function schema(FieldStorageDefinitionInterface \$field_definition) {
return (
// columns contains the values that the field will store
'columns' => (
'value' => (
'type' => 'text',
'size' => 'normal',
'not null' => FALSE,
'serialize' => TRUE
),
),
'indexes' => (
'value' => ('value'),
),
);
}
``````

In FieldWidget/

``````  public function formElement(FieldItemListInterface \$items, \$delta, array \$element, array &\$form, FormStateInterface \$form_state) {
\$sglists = ('1' => 'a', '2' => 'b');
\$element('value') = \$element + (
'#type' => 'checkboxes',
'#options' => \$sglists,
'#empty_value' => '',
'#default_value' => (isset(\$items(\$delta)->value) && isset(\$sglists(\$items(\$delta)->value))) ? \$items(\$delta)->value : NULL,
'#description' => t('Select a Sendgrid List'),
);

return \$element;
}
``````

in schema.yml

``````field.storage_settings.sendgridlists:
label: 'Sendgrid Lists'
type: mapping
mapping:
selectable_lists:
type: sequence
label: 'Selectable Lists'
sequence:
type: string
``````

I am pretty sure my issue comes from the schema.yml but I’m not really understanding how to turn this from a single value, into a multi value list. (similar to core/modules/options)

Any help is greatly appreciated, included any links to existing contrib modules that successfully create a custom `checkboxes` field type that I can reference.

SPFX – Injecting custom javascript at runtime from property pane field

How is it that libraries like StratusForms are able to provide property panes for users to write custom javascript on the fly at runtime and inject that into the page? I don’t understand the fundamental basic principles that allow for that to happen.

Custom field formatter with blob, value always empty

I have the following custom field:

``````/**
* Plugin implementation of the 'price_table' field type.
*
* @FieldType(
*   id = "price_table",
*   default_widget = "price_table_widget",
*   default_formatter = "price_table_formatter",
* )
*/
class PriceTable extends FieldItemBase {

public static function mainPropertyName(): string {
return 'value';
}

public static function schema(FieldStorageDefinitionInterface \$field_definition): array {
return (
'columns' => (
'value' => (
'type' => 'blob',
'size' => 'big',
'serialize' => TRUE,
),
),
);
}

public static function propertyDefinitions(FieldStorageDefinitionInterface \$field_definition): array {
->setLabel(t('Table data'));

return \$properties;
}

public function setValue(\$values, \$notify = TRUE) {
if (isset(\$values) && !empty(\$values('table'))) {
\$values('value') = \$values('table');
unset(\$values('table'));
parent::setValue(\$values, \$notify);
}
}

public function isEmpty(): bool {
try {
\$value = \$this->get('value')->getValue();
dpm(\$value); //<<<
return !is_array(\$value) || empty(\$value);
} catch (MissingDataException | InvalidArgumentException \$e) {
return FALSE;
}
}

}
``````

with the appropriate widget (using a table form element) and formatter present. The editing goes fine, the serialized data gets stored into the database record of my entity. However, when it comes to the formatter, it displays nothing because `isEmpty()` above always gets an empty value and returns `FALSE`. The blob gets stored all right (thanks to `setValue()` above) but it isn’t retrieved by the field.

What am I missing here?

magento2 – magento 2 ui components field in the same container not showing label

magento2 – magento 2 ui components field in the same container not showing label – Magento Stack Exchange

ag.algebraic geometry – Points over algebraic closure of a field

Let $$X$$ be a projective surface (we may assume that $$X = mathbb{P}^2$$, or $$X = mathbb{P}^1timesmathbb{P}^1$$) defined over a field $$K$$. Let $$overline{K}$$ be the algebraic closure of $$K$$, and $$overline{X}$$ the surface over $$overline{K}$$ obtained from $$X$$ by base change.

Fix an natural number $$ainmathbb{N}_{>0}$$. Does there always exist a field $$K$$ such that for any $$a$$ general points $$p_1,dots,p_ainoverline{X}$$ the scheme $${p_1}cupdotscup{p_a}$$ is defined over $$K$$?

To clarify I state my question in a particular case. Is there a field $$K$$ such that for any $$a = 8$$ general points $$p_1,dots,p_8 in mathbb{P}^1_{overline{K}}timesmathbb{P}^1_{overline{K}}$$ (over the algebraic closure of $$K$$) the union $${p_1}cupdotscup{p_8}$$ is defined over the base field $$K$$?

8 – Field enabled in Display mode isn’t showing up when node is accessed?

I am using a third-party theme that is using panelizer. When I created a new field (entity_reference) and enabled that in Display mode, the field is not showing up for the webpages but when it does show up for other content type which doesn’t have Panelizer enabled.

Is there any other way through which Drupal takes the display settings?

html – Datepicker popup box does not show up for the 2nd form field

I have a form like this:

``````<form method="" action="">
<label for="discountValue">Discount Value</label>
<input type="text" class="form-control" id="discountValue" name="discount_value[]">

<label for="timeSpanStart">Start Date</label>
<input type="text" class="form-control datepicker" id="timeSpanEnds" name="time_span_starts[]">

<label for="timeSpanEnds">End Date</label>
<input type="text" class="form-control datepicker" id="timeSpanEnds" name="time_span_ends[]">

<label for="labelDiscount">Discount Label</label>
<input type="text" class="form-control" id="labelDiscount" name="discount_label[]">

<button class="btn btn-success" type="submit">Submit</button>
</form>
``````

As you can see here I have used two `datepickers` form fields, one of them is `timeSpanStart` and the other one is `timeSpanEnds`.

Now the datepicker popup appears for the 1st form field but it does not appear for the 2nd form field somehow.

So what’s going wrong here? How can I fix this issue?

migration – Fill multi-value field from comma separated values in a field

I have data in xml which I want to import into drupal. Which works fine. But one field in the xml is filled with a comma separated list of terms. There is a target field in drupal which is a multi-valued field. I do not need those as a taxonomy, just as multi-value for solr search. I just want to expand the `one,fourty,flower,...` values to fill the multiple-value field.

It absolutely will not work. Any help?

Here is the latest iteration (I tried a lot in the last two days) which fails spectacularly with an error like so:

``````Error: Unsupported operand types in /var/www/dev.diercke.com/web/core/modules/migrate/src/Plugin/migrate/process/SubProcess.php on line 206 #0 /var/www/dev.diercke.com/web/core/modules/migrate/src/MigrateExecutable.php(399): DrupalmigratePluginmigrateprocessSubProcess->transform(Array, Object(Drupalmigrate_toolsMigrateExecutable), Object(DrupalmigrateRow), 'field_stichwort...')
#1 /var/www/dev.diercke.com/web/core/modules/migrate/src/MigrateExecutable.php(205): DrupalmigrateMigrateExecutable->processRow(Object(DrupalmigrateRow))
#2 /var/www/dev.diercke.com/vendor/drush/drush/includes/drush.inc(206): DrupalmigrateMigrateExecutable->import()
#3 /var/www/dev.diercke.com/vendor/drush/drush/includes/drush.inc(197): drush_call_user_func_array(Array, Array)
#4 /var/www/dev.diercke.com/web/modules/contrib/migrate_tools/src/Commands/MigrateToolsCommands.php(958): drush_op(Array)
#5 (internal function): Drupalmigrate_toolsCommandsMigrateToolsCommands->executeMigration(Object(DrupalmigratePluginMigration), 'karte', Array)
#6 /var/www/dev.diercke.com/web/modules/contrib/migrate_tools/src/Commands/MigrateToolsCommands.php(418): array_walk(Array, Array, Array)
#7 (internal function): Drupalmigrate_toolsCommandsMigrateToolsCommands->import('karte', Array)
#8 /var/www/dev.diercke.com/vendor/consolidation/annotated-command/src/CommandProcessor.php(257): call_user_func_array(Array, Array)
#9 /var/www/dev.diercke.com/vendor/consolidation/annotated-command/src/CommandProcessor.php(212): ConsolidationAnnotatedCommandCommandProcessor->runCommandCallback(Array, Object(ConsolidationAnnotatedCommandCommandData))
#10 /var/www/dev.diercke.com/vendor/consolidation/annotated-command/src/CommandProcessor.php(176): ConsolidationAnnotatedCommandCommandProcessor->validateRunAndAlter(Array, Array, Object(ConsolidationAnnotatedCommandCommandData))
#11 /var/www/dev.diercke.com/vendor/consolidation/annotated-command/src/AnnotatedCommand.php(311): ConsolidationAnnotatedCommandCommandProcessor->process(Object(SymfonyComponentConsoleOutputConsoleOutput), Array, Array, Object(ConsolidationAnnotatedCommandCommandData))
#12 /var/www/dev.diercke.com/vendor/symfony/console/Command/Command.php(255): ConsolidationAnnotatedCommandAnnotatedCommand->execute(Object(DrushSymfonyDrushArgvInput), Object(SymfonyComponentConsoleOutputConsoleOutput))
#13 /var/www/dev.diercke.com/vendor/symfony/console/Application.php(1027): SymfonyComponentConsoleCommandCommand->run(Object(DrushSymfonyDrushArgvInput), Object(SymfonyComponentConsoleOutputConsoleOutput))
#14 /var/www/dev.diercke.com/vendor/symfony/console/Application.php(273): SymfonyComponentConsoleApplication->doRunCommand(Object(ConsolidationAnnotatedCommandAnnotatedCommand), Object(DrushSymfonyDrushArgvInput), Object(SymfonyComponentConsoleOutputConsoleOutput))
#15 /var/www/dev.diercke.com/vendor/symfony/console/Application.php(149): SymfonyComponentConsoleApplication->doRun(Object(DrushSymfonyDrushArgvInput), Object(SymfonyComponentConsoleOutputConsoleOutput))
#16 /var/www/dev.diercke.com/vendor/drush/drush/src/Runtime/Runtime.php(118): SymfonyComponentConsoleApplication->run(Object(DrushSymfonyDrushArgvInput), Object(SymfonyComponentConsoleOutputConsoleOutput))
#17 /var/www/dev.diercke.com/vendor/drush/drush/src/Runtime/Runtime.php(48): DrushRuntimeRuntime->doRun(Array, Object(SymfonyComponentConsoleOutputConsoleOutput))
#18 /var/www/dev.diercke.com/vendor/drush/drush/drush.php(72): DrushRuntimeRuntime->run(Array)
#19 /var/www/dev.diercke.com/vendor/drush/drush/drush(4): require('/var/www/dev.di...')
#20 {main}
Error: Unsupported operand types in DrupalmigratePluginmigrateprocessSubProcess->transform() (line 206 of /var/www/dev.diercke.com/web/core/modules/migrate/src/Plugin/migrate/process/SubProcess.php).
(warning) Drush command terminated abnormally.
``````
``````...
process:
...
field_stichworte: tags
field_stichworte_einzeln:
- plugin: explode
source: tags
limit: 10000
delimiter: ,
- plugin: deepen
- plugin: sub_process
process:
field_stichworte_einzeln:
- plugin: extract
index:
- 0
...
``````

9 – Find value of another field in a fieldformatter

This may be complicated to explain

I have a content type with field_1, field_2 etc

field_1 is a taxonomy reference

field_2 is a custom field with various sub-values

I have a custom formatter for field_2 which does all sorts of things to hang the sub-values into the desired output, however, I now have a condition for a certain value of field_1 which requires a different formatting to happen to field_2 that is not dependent on the field_2 values.

I need the formatter to handle this as the field will be required in various output scenarios (custom module, views, XML export) and I don’t want to have to build multiple mechanisms for handling the data.

My question therefore is how I can grab field_1 from within the formatter of field_2 so that I can apply conditional format logic to it.

I could modify field_2 to contain a flag to control this formatting, however, there are > 20K records to add a value to whereas it’s 1 additional field in a taxonomy record where there are less than 25 values, it would also allow an editor to set the formatting flag independently of the selected taxonomy and potentially an incorrectly displayed value. I can pass values to the formatter from custom module code, however, this needs to be applied when a “normal” user creates their own view or other brings back the field into a view or page.

Hope this makes sense