Date popup field won’t display in tableselect element

I am attempting to embed a couple of date fields within a tableselect element, and after trying to use both textfield and date_popup field types, I can’t get either to work. Here’s my form function using textfields:

function language_dashboard_overview_form($form, &$form_state, $entity) {
  $form = [];
  $options = [];

  $header = [
    'language_locale' => t('Language Locale'),
    'status' => t('Status'),
    'staging_url' => t('Staging URL'),
    'start_date' => t('Start Date'),
    'end_date' => t('End Date'),
    'display_title' => t('Display Title')
  ];

  $translations = $entity->translations->data;

  foreach($translations as $locale => $locale_data) {
    // Get data for all the other fields here
    ...
    // Define start and end date text fields.
    $start_date = new DateTime($entity->field_locale_publishing_dates[$locale][0]['value']);
    $new_start_date = $start_date->format('m-d-Y');

    $end_date = new DateTime($entity->field_locale_publishing_dates[$locale][0]['value2']);
    $new_end_date = $end_date->format('m-d-Y');

    $start_date_field = [
      'data' => [
        '#type' => 'textfield',
        '#size' => 10,
        '#maxlength' => 10,
        '#default_value' => $new_start_date
      ]
    ];

    $end_date_field = [
      'data' => [
        '#type' => 'date_popup',
        '#date_format' => 'm-d-Y',
        '#date_year_range' => '0:+20',
        '#default_value' => $new_end_date
        ]
    ];

    $options[] = [
      'language_locale' => $locale_link,
      'status' => $status,
      'staging_url' => $stage_url,
      'start_date' => $start_date_field,
      'end_date' => $end_date_field,
      'display_title' => $title
    ];

  }

  $form['dashboard'] = [
    '#type' => 'tableselect',
    '#header' => $header,
    '#options' => $options
  ];

  $form['submit'] = [
    '#type' => 'submit',
    '#value' => t('Submit')
  ];

  return $form;
}

With that, I get the fields, but no default value is filled in (and I’ve verified that the $start_date_field and $end_date_field variables have the desired data).

If I try it with date_popup fields like so:

$start_date_field = [
  'data' => [
    '#type' => 'date_popup',
    '#date_format' => 'm-d-Y',
    '#date_year_range' => '0:+20',
    '#maxlength' => 10,
    '#default_value' => $new_start_date
  ]
];

$end_date_field = [
  'data' => [
    '#type' => 'date_popup',
    '#size' => 10,
    '#maxlength' => 10,
    '#default_value' => $new_end_date
  ]
];

I get no field at all in those columns. From the multiple items I’ve read on this, I’m adding the fields correctly to the tableselect. Is there something else I’m missing?

UPDATE: I discovered that for the text field, you use #value instead of #default_value. changing that shows my default date as desired. so the only remaining issue is that I can’t get anything to show for a date_popup field.

Does changing field of study have exclusively negative effects on my future career? [on hold]

I have recently completely my Bachelor’s degree in physics with a 3.2 Grade Point Average.

However I am interested in the field of electronics and to this end I have decided to take a Master’s in Electrical Engineering.

One of my professors however has opined that this is a complete change of field and that doing such a radical shift will negatively affect my future career prospects.

Is such a shift damaging to career prospects?

Editing Appearance of Lookup Field in SP Workflow Email

I have a workflow that sends an email when a new item is added to a list. The email includes the creator of the new item, which uses a lookup value.

CurrentItem-CreatedBy-String = [%Current Item:Created By%]

which when emailed, comes out with the following format

i:0#.w|Domain1ddono25

I understand that the beginning “i:0#.w|” is because of the claims authentication, but is there any way to strip that portion out when an email is sent?

Compute pushforward vector field of $partial_phi$ on a parametrization of an open set $U$ on $mathbb S^2$

Let $U subset mathbb S^2$ be an open subset. We parametrize it by the map
$$ F(varphi, theta) = (sin(varphi)cos(theta), sin(varphi)sin(theta), cos(varphi).$$
Now I want to compute the pushforward of $F_*(partial_{varphi})$. The matrix representation of the differential $F_*$ is given by
begin{align*}
begin{pmatrix}
cos(theta) cos(varphi) & -sin(theta)sin(varphi) \
cos(varphi) sin(theta) & sin(varphi)cos(theta) \
-sin(phi) & 0
end{pmatrix}.
end{align*}

If I am not mistaken, the pushforward is given by $X_*(partial_{varphi}) = cos(theta)cos(varphi) partial_x + sin(theta) cos(varphi) partial_y – sin(varphi) partial_z$ where $(x, y, z)$ are coordinates on $mathbb R^3$. Ideally, I want the coefficient functions to be of $x, y, z$. But it is getting ugly. Is my computation correct and how should I proceed?

Issue with custom fieldtype using shared form field

I am working on a custom fieldtype which essentially displays a select dropdown with some custom options. To keep in line with EE’s styles I’m trying to use their shared form field to get it to display with their rich select dropdown field view.

The issue arises when this is added to a Fluid field. When it’s first added to the Fluid field the options are populated, but you’re unable to click the dropdown to display them (inspector tools verifies the options actually are there in the .field-drop-choices div. However, you’re able to save the channel entry and when you go back to edit it you’re then able to click the dropdown to display the option list.

This is my current display_field() method:

public function display_field($data)
{
    ee()->javascript->output('
        FluidField.on("dropdown", "add", function(element){
            Dropdown.renderFields(element);
        });
    ');

    ee()->lang->loadfile('fieldtype_name');

    $forms = $this->get_forms();

    if(empty($forms))
    {
        return '

'.lang('error_message').'

'; } else { return ee('View')->make('ee:_shared/form/field')->render(array( 'field_name' => $this->field_name, 'field' => array( 'type' => 'dropdown', 'choices' => $forms, 'value' => $data ), 'grid' => FALSE )); } }

Is there something I’m missing to get this to start working immediately when added?

Drupal 7 Content Type Field – How to Properly Add Boolean Field

enter image description hereI have a content type, I’m trying to add a field that’s a boolean. I want the options to be yes or no. This is something I thought would be relatively simple however, I keep getting an error message. I’ve attached 2 screenshots. 1 is the configuration for my boolean. The other is the error message my site gets. Can someone help me. What am I doing wrong?

enter image description here

how to get views field names/values for hook_views_pre_render?

I’m trying to figure out how to modify a view’s results with hook_views_pre_render. How do I get the available values to work with? I’ve turned on Devel and Kint, but I don’t see any array on the page that includes views stuff.

I’ve tried blindly finding fields using machine names, but it just breaks the page. I’m sure I’m doing the right thing, I have one field “field_byline” that I’m able to get just fine with a simple set() to see if I’m able to do anything.

Here’s what I’ve got:
function webinar_rearrange_views_pre_render(ViewExecutable $view) {

      if($view->id() == 'viewname'  && $view->current_display == 'block_1' ){

        foreach($view->result as $key => $value){
          $value->_entity->set('title', 'test title'); // worked
          $value->_entity->set('body', 'test body'); // worked
          $value->_entity->set('field_byline', 'test byline');
          $value->_entity->set('field_view_node', 'http://test.com'); // DOESN'T WORK - maybe it's an array? How do I do those?
        }
      }
    }

Retrieve all possible values for a REFERENCE field

How can I retrieve all possible values for a REFERENCE field.

I mean such a field that

Schema.SObjectField field = doesNotMatter();
String fieldName = field+'';
//fieldName now holds "NameOfTheField"
Schema.DescribeFieldResult fieldResult = field.getDescribe();
String typeName = fieldResult.getType()+'';
//typeName now holds "REFERENCE"

I know that this is a field of a SomeObj object.

Thank you.

Can’t specify OID field in arcpy.MakeQueryLayer_management

I manage a library of query layers and have recently had the need to apply the same update to a bunch of them at once. Seems the only way to do that in python is to create new ones and apply symbology from the old ones and that’s fine. But in creating new ones, one of the important bits is specifying the field(s) that provide a unique identifier. There is a parameter for this in arcpy.MakeQueryLayer_management but the layers that come out of my script have the first field in the list checked rather than the one that I specified near the bottom. What am I missing?

Below is the business end of the script I wrote that contains commented examples of things I’ve tried to specify that parameter successfully.

arcpy.MakeQueryLayer_management(
    input_database = self._environment.DatabaseConnections["Database"],
    out_layer_name = self.LayerName,
    query =          self.Query,  # SELECT * FROM Database.Schema.View
    # None of these work--first field in layer gets auto-selected every time
    oid_fields =     "FieldName",
    #oid_fields =     "View.FieldName",
    #oid_fields =     "Schema.View.FieldName",
    #oid_fields =     "Database.Schema.View.FieldName",
    #oid_fields =     "Instance.Database.Schema.View.FieldName",
    #oid_fields =     ["FieldName"],
    #oid_fields =     ["Instance.Database.Schema.View.FieldName"],
    #oid_fields =     "FieldName;SecondFieldNameJustToMakeAList",
    #oid_fields =     ["FieldName","SecondFieldNameJustToMakeAList"],
    #oid_fields =     "YouCanBeSureThisNameAppearsNowhereInTheDatabase",
    shape_type =     "POINT",
    spatial_reference = arcpy.SpatialReference(102605)
    )

I’ve also tried (to no effect):

  • Running the associated tool in ArcMap produces the desired results
  • Adding that tool to ModelBuilder and exporting python from there. That parameter was specified by sequence simply as “FieldName” in the exported python, but that script contained dozens of lines of python specifying seemingly every Arcpy environment setting possible and then immediately resetting them to their old values afterward. I dumped all that into my script immediately above and below the tool reference.
  • Specifying the parameters by position rather than by keyword
  • Source queries in the query layers in our library have always been SELECT * FROM VIEW... and I tried specifying field names instead

The obvious hack I’d like to avoid:

Arcpy doesn’t throw a “Field Not Found” sort of exception but rather just picks the first field that it encounters and keeps trucking (as if that doesn’t have great potential to hose things up down the road). Consequently one might hack a solution by re-wiring the views these layers query to put the primary key first, but then there’d have to be other rigmarole to reorder fields in the layer so that users are presented info in the order they expect.