texts: Hi i am using drupal services 3 module. Every thing is perfect except updating date field. I tried many ways to update that field but didn't get any solution. Is any core issue related to date field?


texts:
How to apply pagination on checkbox options of form elements in Drupal?

for example:

$form['display'] = array(
        '#title' => t('Type'),
        '#type' => 'checkboxes',
        '#description' => t('Please Select Type'),
        '#options' => theme('xyz',array($disclaimer_term)).theme('pager'),
    );

Is this possible to limit the number of options of checkbox?


texts: What is wrong with this schema definition and db query?

texts:
Hello and thank you for your time to help me in this weird case.
I have a schema API function that returns few database table information, and everything seem to work fine... except the most simple table.

$schema['quotes_key'] = array(
  'description' => 'Auth keys for quotes',
  'fields' => array(
      'qid' => array(
        'description' => 'The {quotes} this key belongs to.',
        'type' => 'int',
        'not null' => TRUE,
      ),
      'key' => array(
        'description' => 'Key of the qid to be accessed anonymously.',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
      ),
    ),
    'primary key' => array('qid'),
    'indexes' => array(
      'qid'        => array('qid'),
    ),
  );

Then, I use drupal_write_record to write a new object to the database.

$key = new stdClass();
$key->qid = 789;
$key->key = md5(uniqid());
drupal_write_record('quotes_key', $key);

Whenever I run this code, I'm getting a mysql error:

user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'key) VALUES (789, '02ab38a849e02744f532cdf3137df146')' at line 1 query: INSERT INTO quotes_key (qid, key) VALUES (1, '02ab38a849e02744f532cdf3137df146') in .../includes/common.inc on line 3576.

Can anyone kindly help me to figure out the problem ? I tried db_query to do the same database INSERT but getting same error. So I guess the problem is with my schema.
the qid is stored in a {quote} table.

I tried reinstalling schema by drupal_uninstall_schema() and drupal_install_schema()

Thank you.


texts: Converting MySQL to db_select with subquery count

texts:
I have an SQL query, with subquery, that returns as set of nodes ordered by referenced nodes... It works fine in a db_query, but I need it to be dynamic, and it feels like a better idea to use Drupal's abstraction layer.

I have got so far, but I am having issues with the subquery. It doesn't appear to having any effect...

I should say I used the Query Coder module to help do the conversion.

SQL:

SELECT n.nid , dest.field_flight_hero_destination_tid  hero_desintation_tid , (
SELECT COUNT( * )
FROM {field_data_field_field_route_matrix} routes
LEFT JOIN  {field_data_field_flight_destination} destination ON routes.field_field_route_matrix_target_id = destination.entity_id
WHERE routes.entity_id = n.nid
AND  field_flight_destination_tid
IN (:stopovers_tids)
)total
FROM node n
LEFT JOIN  field_data_field_flight_hero_destination dest ON n.nid = dest.entity_id
LEFT JOIN field_data_field_flight_price_matrix prices ON n.nid = prices.entity_id
LEFT JOIN field_data_field_flight_cabin_class class ON n.nid = class.entity_id
WHERE dest.field_flight_hero_destination_tid = :destination_tid AND class.field_flight_cabin_class_tid IN (:class_tid)
ORDER BY total DESC

db_select:

// Subquery.
  $subquery  = db_select('{field_data_field_field_route_matrix}', 'routes');
  $subquery->addExpression('COUNT(*)', 'count');
  $subquery->leftJoin('{field_data_field_flight_destination}', 'destination', 'routes.field_field_route_matrix_target_id = destination.entity_id');
  $subquery->condition('routes.entity_id', 'n.nid');
  $subquery->condition('field_flight_destination_tid', $stopovers);

  // Main query sorted by subquery.
  $query = db_select('node', 'n');
  $query->fields('n', array('nid'));
  $query->fields('dest', array('field_flight_hero_destination_tid'));
  $query->addJoin('', $subquery, 'total');
  $query->leftJoin('field_data_field_flight_hero_destination', 'dest', 'n.nid = dest.entity_id');
  $query->leftJoin('field_data_field_flight_price_matrix', 'prices', 'n.nid = prices.entity_id');
  $query->leftJoin('field_data_field_flight_cabin_class', 'class', 'n.nid = class.entity_id');
  $query->condition('dest.field_flight_hero_destination_tid', $destination);
  if (!empty($cabin_class)) {
    $query->condition('class.field_flight_cabin_class_tid', array($cabin_class), 'IN');
  }
$query->orderBy('total.count', 'DESC');
$result = $query->execute();

Generated output:

[queryString] => SELECT n.nid AS nid, dest.field_flight_hero_destination_tid AS field_flight_hero_destination_tid
FROM
node n
 JOIN (SELECT COUNT(*) AS count
FROM
field_data_field_field_route_matrix routes
LEFT OUTER JOIN field_data_field_flight_destination destination ON routes.field_field_route_matrix_target_id = destination.entity_id
WHERE  (routes.entity_id = :db_condition_placeholder_1) AND (field_flight_destination_tid IN  (:db_condition_placeholder_2)) ) total
LEFT OUTER JOIN field_data_field_flight_hero_destination dest ON n.nid = dest.entity_id
LEFT OUTER JOIN field_data_field_flight_price_matrix prices ON n.nid = prices.entity_id
WHERE  (dest.field_flight_hero_destination_tid = :db_condition_placeholder_0)
ORDER BY total.count DESC
)

Devel dpq:

SELECT n.nid AS nid, dest.field_flight_hero_destination_tid AS field_flight_hero_destination_tid
FROM
{node} n
 JOIN (SELECT COUNT(*) AS count
FROM
{field_data_field_field_route_matrix} routes
LEFT OUTER JOIN {field_data_field_flight_destination} destination ON routes.field_field_route_matrix_target_id = destination.entity_id
WHERE  (routes.entity_id = 'n.nid') AND (field_flight_destination_tid IN  ('31', '366')) ) total
LEFT OUTER JOIN {field_data_field_flight_hero_destination} dest ON n.nid = dest.entity_id
LEFT OUTER JOIN {field_data_field_flight_price_matrix} prices ON n.nid = prices.entity_id
WHERE  (dest.field_flight_hero_destination_tid = '86')
ORDER BY total.count DESC


texts: How to render user profile edit form in block?

texts: I want to render fields of user profile edit page  like "User Name ","current Password","email" in a customblock


texts: How to treat textfield as integer field while adding sorting in views?

texts:
I have a textfield in my content type. It have values like 1, 2, 3, ..., 10. While I adding sorting it sorts the content like 1, 10, 2, ...

I can write the custom handler for it, But how can I treat it as integer in sorting while adding a query. Currently sort handler implements the following query :

$this->query->add_orderby($this->table_alias, $this->real_field, $this->options['order']);

What change I have to do?


texts: Hook "form_views_exposed_form_alter" is called multiply times

texts:
I would like to understand why form_views_exposed_form_alter is called multiply times.

There is just one view, also there is just one exposed filter. However the hook is getting called twice.

xyz_form_views_exposed_form_alter(&$form, FormStateInterface $form_state, $form_id) {
   dpm('inner');
}

Is there any value I can use for an if statement to run my script just once?


texts:
I want to use the Bakery module to login and synchronize users, but I am not able to synchronize existing accounts. Users that exist only on slave cannot login confirms Bakery doesn't provide pre-sync facility.

May someone help me to synchronize existing user accounts, possibly at database level, for example with drush rsync or sql sync?


texts: How do I set descriptions to each checkbox option

texts:
Is there a way to set descriptions to each checkbox option? What I would like is for Option #1 to display and then directly below it a description for it, then Option #2 along with its description.
I have:

 $form['field_options'] = array(
                    '#type' => 'checkboxes',
                    '#options' => array(
                        0 => t('Option #1'),
                        1 => t('Option #2')),
                    '#title' => t('Select Options'),
                    '#description' => t('Entering a description here will display below the last item in the array'),
                    '#default_value' => array(0)
            );

Also, for some reason $form_state['values']['field_options'] in function hook_node_submit() shows

Array
(
    [0] => 0
    [1] => 0
)

shouldnt it show what the states of the checkboxes are like this?:

Array
(
    [0] => 1
    [1] => 0
)

Thanks


texts:
I want to change the sorting of a view with something very specific which needs 2 subqueries.

So far, I tried to do something like this:

$sorted = false;

function mymodule_query_alter(&$query) {
  global $sorted;

  $view = $query->getMetaData('view');
  if( !$sorted && $view->name == 'my_view' ) {
    $sorted = true;

    $subquery_1 = clone $query;
    $subquery_2 = clone $query;

    // Apply sorting stuff...

    $query = $subquery_1->union($subquery_2);
}

Then I just realized that this desn't even work (while my view is working):

$subquery = clone $query;
$query = $subquery;
dpm($query->__toString());
dpm($query->arguments());

It doesn't return any result, but everything seems ok in the dpm dump.

Have I done something wrong? Or maybe should I handle this problem in another way?

EDIT:

I need to get a list of nodes sorted this way:

Sticky nodes | order by date.
Nodes in one of the taxonomy-term selected in user profile | order by date.
Other nodes | order by date.

I've already a working SQL request (actually 3 with UNION), but I need to make it work with Drupal.


texts: How to set a checkbox using POST request with Services Module?

texts: I am trying to set a checkbox in a display using a post request by setting the value of the mark field to 1, specifically field_mark_as_discounted. But I can't seem to be able to achieve that. Note: The checkbox functions well when set manually. If anyone has come across this issue of setting a checkbox using post request please share.


texts: How to create view with user's flagged content?

texts:
I created a flag 'Add to favorites' with the Flag module and I'd now like to create a view for the user's profile that sums up all his/her favorite content. I tried to add the relationship Flags: add_to_favorites (by current user) to my view, but then the favorites of the logged in user appear on every profile page.

How can I solve this?


texts:
Not a real issue but more of an informative question.

Concrete case:

system.routing.yml integrates system.entity_autocomplete that uses controller::method

\Drupal\system\Controller\EntityAutocompleteController::handleAutocomplete. First parameter in handleAutocomplete() is $request and the rest are the ones we could explect from url.

Where did $request come from?


texts: How can I implement a form into a DC view footer?

texts:
I am trying to make a shipping quote module for Drupal Commerce (DC) and I am trying to do it within the DC cart view footer by sending a form within a view.

I have done quite a bit of research and just can't seem to find the answer. The place I am now is trying to do it with a views handler. However, I can't even get the handler to show up in the footer add options.

My current .module code:

<?php
function MY_MODULE_form($form, &$form_state) {
  $form = array();

  //Zip Code
  $form['zip_code'] = array(
'#title' => '',
'#type' => 'textfield',
'#field_prefix' => t('Zip Code:'),
'#maxlength' => 5,
'#size' => 5,
  );

  //Shipping Select
  $form['carrier_select'] = array(
    '#type' => 'select',
    '#options' => array(
      'null' => 'Select Shipping',
      'ups_ground' => 'UPS Ground',
      'usps_priority' => 'USPS Priority'),
      '#ajax' => array(
      'callback' => 'MY_MODULE_form_callback',
    ),
    '#suffix' => '

',
  );

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

/**
 * Ajax callback triggered by select.
 */
function MY_MODULE_form_callback($form, $form_state) {
  require_once(DRUPAL_ROOT . '/sites/all/modules/commerce_shipping/modules   /MY_MODULE/includes/plugins/ups/fd_getrate.php');
  $commands = array();
  $commands[] = ajax_command_html('#commerce_ups_ship_price',    get_ups($form_state['values']['zip_code']));
  $commands[] = ajax_command_data('#commerce_ups_ship_price', 'form_state_value_select', $form_state['values']['zip_code']);
  return array('#type' => 'ajax', '#commands' => $commands);
}

/**
 * Implementation of hook_views_api
 */
function MY_MODULE_views_api() {
  return array(
    'api' => 3,
    'path' => drupal_get_path('module', 'MY_MODULE') . '/includes/views',);
}
?>

Plus .inc for the view handler:

class MY_MODULE_shipping_form extends views_handler_area {

  function option_definition() {
    $options = parent::option_definition();

    // TODO: Update with options

    return $options;
  }

  function options_form(&$form, &$form_state) {
    parent::options_form($form, $form_state);

    unset($form['empty']);

    // TODO: Update with options
  }

  function render($values) {
    return drupal_render(drupal_get_form('MY_MODULE_form'));
  }
}

Plus the .inc for views:

function MY_MODULE_views_data() {
  $data = array();
  // Define an footer handler for displaying shipping quotes.
  $data['MY_MODULE']['handler'] = array(
     'handler' => 'MY_MODULE_shipping_form',
     'title' => t('Shipping API Quotes'),
     'help' => t('Display a user input form to allow the retrieval of shipping quotes.'),
  );

  return $data;
}

On this last one I don't have a clue of what I am doing.

Anyone who can help me on this one?

FYI - I am using Commerce Kickstart + Views3


texts: How do I treat the phrase as individual words in Search?

texts:
I have a problem in our Search results. We are using Search API and Search API Solr modules running in drupal 8.

We have successfully indexed our content in Solr and is pretty working.

For example, I have a term called "Jakarta Law firm" and it will display the results like: Jakarta Law Firm in 2000, Jakarta Law Firm in 2001, etc.

However, if I searched "law firm Jakarta", it will return no results. Can you please tell me if there are any configurations in Solr or in the module so that it will search whatever the order of the search words? Or may I know what is the Solr term functionality that will handle that? Or any hooks that we can use?

I really appreciate your help about this!


texts: Authcache Caching Cancelled due to php error

texts:
I have authcache installed on my Drupal site that runs on commerce(not Kickstart)

On all the page I am getting

Cache Status: "Caching CANCELED"
Message 1: "Canceled: PHP Error: "

I enabled database logging but I don't see any additional information there.

My pages are rendered properly and there is no errors being displayed on the page. So I am curious about the source of PHP Error that Authcache keeps referring to.


texts: Update a content type field via db not working D8

texts:
I have a content type field with machine name field_p_frontip and for that i have a table node__field_p_frontip and in that there is field value like field_p_frontip_value . Eventhough i manually inserted a value in to that field its not taking effect in the front end . I updated the value in the node_revision__field_p_frontip table too and cleared the cache .Why its not working ,any idea ?

I done this because i done via hook_form_alter and its not taking effect .

node__field_p_frontip table structre :

+-----------------------+------------------+------+-----+---------+-------+
| Field                 | Type             | Null | Key | Default | Extra |
+-----------------------+------------------+------+-----+---------+-------+
| bundle                | varchar(128)     | NO   | MUL |         |       |
| deleted               | tinyint(4)       | NO   | PRI | 0       |       |
| entity_id             | int(10) unsigned | NO   | PRI | NULL    |       |
| revision_id           | int(10) unsigned | NO   | MUL | NULL    |       |
| langcode              | varchar(32)      | NO   | PRI |         |       |
| delta                 | int(10) unsigned | NO   | PRI | NULL    |       |
| field_p_frontip_value | longtext         | NO   |     | NULL    |       |
+-----------------------+------------------+------+-----+---------+-------+

and node_revision__field_p_frontip table structure :

+-----------------------+------------------+------+-----+---------+-------+
| Field                 | Type             | Null | Key | Default | Extra |
+-----------------------+------------------+------+-----+---------+-------+
| bundle                | varchar(128)     | NO   | MUL |         |       |
| deleted               | tinyint(4)       | NO   | PRI | 0       |       |
| entity_id             | int(10) unsigned | NO   | PRI | NULL    |       |
| revision_id           | int(10) unsigned | NO   | PRI | NULL    |       |
| langcode              | varchar(32)      | NO   | PRI |         |       |
| delta                 | int(10) unsigned | NO   | PRI | NULL    |       |
| field_p_frontip_value | longtext         | NO   |     | NULL    |       |
+-----------------------+------------------+------+-----+---------+-------+

From Berdir's comment

I was trying to set the value of the field 'field_p_frontip' in form_alter as follows , but both didnt worked .

$form['field_p_frontip']["en"][0]['#default_value']['value'] ='192.168.1.100'; $form['field_p_frontip']['#default_value'] = '192.168.1.100';


texts: mymodule.install file not creating the table in drupal 7

texts:
I have a very simple table in my .install file and for some reason is not creating the table. What can it be? something i have to add in the .info file? please help.

Its a drupal 7.

this is what i have in my my_module.install file.

function my_module_schema() {
  $schema['my_module_config'] = array(
    'description' => 'Configuration settings for the my_module web service.',
    'fields' => array(
      'name' => array(
        'description' => 'Name ',
        'type' => 'varchar',
        'length' => 50,
        'not null' => TRUE,
        'default' => '',
      ),
    ),
  );

  return $schema;
}


texts: I was wondering why caches exist. As a Drupal newbie, I often read solutions for all kind of problems that mention "you have to clear caches". Therefore, it appears to me that they only have disadvantages. This may sound a bit naive, but I would like to know what their purpose is.


texts: Conditional views exposed filters (using Search api views)

texts:
I have two views exposed filters,one dropdown field and a checkbox.
I want,when the checkbox is checked the dropdown field to dissappear.When I uncheck the checkbox I want the dropdown field to appear again.

First I tried Views dependent filter,however it doesn't play well with Search api views.

Secondly I tried with javascript.I wrote this code and added it to the .js file of my theme.However it doesn't also work.How can I do this?

(function ($) {
  Drupal.behaviors.cdgi = {
    attach: function(context) {

      var $('#edit-field-level-of-telecommuting-1').prop('checked') = true;
      if ($('#edit-field-level-of-telecommuting-1').prop('checked') === true) {
        $('#edit-field-job-region-parents-all').hide();
      } else {
        $('#edit-field-job-region-parents-all').show();
      }
    }
  }
}(jQuery));`


texts: Add taxonomy term description to views-view-fields--taxonomy_banner.html.twig

texts:
using taxonomy term view to render my products in Drupal 8.9 with commerce 2 .
I am trying to add the term description under a banner .. but struggling to find what I need to add.
new to twig,and theming
any help appreciated.
I have added

{{ fields.description.content }}

{% set banner =  row._entity.field_banner %}
{% if fields.name %}

{{ fields.name.content }}

{% endif %}
{% if banner is not empty %}

    {% for value in banner %}

{{ fields.description.content }}

    {% endfor %}

{% endif %}

If someone could kindly explain where I am going wrong ...thanks


texts: Workflow for an entity based menu system?

texts:
I've been considering stopping to use the menu system all together, in favor of taxonomy terms, or other entities. Entities are superior to regular menu-entries in many ways because they integrate well with most other Core systems as well as contrib.

Since vocabularies already have the ability to create a hierachical structure, taxonomy terms seems to be the ideal candidate here.

The question is, how have you attempted to implement this, and how did it work out? Are there any pitfalls that one should be aware of before trying this, or any limitations that limit the usability of this approach?


texts: Alter field content inside modules hook_node_view

texts: I'd like to alter, but not save, a fields output.  I've got a MODULE_node_view already setup.  Is there a way to do this?  I don't want to save the output permanently.


texts: Organic Groups - Display the Group Name that a peice of content belongs to

texts:
I have a view that is listing all of the content tagged with a taxonomy terms (contextual filter).  Underneath the note title, I would like to include some meta that says: posted by username who belongs to "group name" and link that over to the associated group. Here is a screenshot of my current view:

http://cl.ly/image/0Z103y3q3D1z

Any help is much appreciated. I can't seem to find a "group name" or "group title" field anywhere when attempting to use fields associated with a relationship.

Thanks for any help.


texts: Display fields base on grouped views row count

texts:
I'm creating a view that return grouped rows. Depend on the rows count under each group, I want to show different fields.

For example,

Group 1

row 1
row 2
row 3

Group 2

row 1
row 2
row 3
row 4

Group 3

row 1
row 2
row 3
row 4
row 5

Let's say if I have limited space then for Group 1, I want to show full text for all 3 rows. For Group 2, I want to show full text for the rows 1 & row 2 then trimmed text for the row 3 & 4. For Group 3, I only want full text for row 1 then trimmed text for the rest.

In Views advanced setting Theme:Information Style template print rows and Row style template print fields. In Row style template, if I know which row am I printing and how many rows in that group then I know which fields to display. For example, If I'm printing row 2 in the group of 5 then I know I need to display trimmed text field.

So my question is how can I know that in Row style template?

Thank you!


texts: Is there a limit on taxonomy hierarchy depth by default?

texts: Is there a limit on a taxonomy hierarchy depth by default? This question's answer states that the default limit is 9 due to database table structure, but I successfully nested 10+ terms in a vocabulary locally, so that doesn't seem to be correct.


texts:
I'm working on a website that is interested in adding chat features. I did some research, and ended up installing the DrupalChat module, and its dependencies. After configuring the module, I realized it would not work for anonymous users unless I also installed the Session API module.

My concern is that on the Session API module information page, it displays a banner stating that

  This project is not covered by Drupal’s security advisory policy.

I have not run into this issue before, so I'm not sure how leery I should be to use the Session API module?

Does this mean it's likely to receive a future update to address pending security issues? Should I use some other method of adding chat to the web site? If so, any recommendations?


texts: Change "Passwords match" and "Password Strength" text on signup

texts: How do I change the "Password Strength:Weak" and "Passwords Match:no" text on the sign up page. Are there drupal settings for this?


texts: Using drupal_render() for Simplenews checkbox disables username and password fields

texts:
I have a custom user-register.tpl.php file in which I have:

<?php print drupal_render($form['simplenews']); ?>

along side several other renders, and when this specific one is active, the following renders: name, mail and password, do not output, which makes my user register page useless.

Anyone knows why and if there is someway I can avoid this? I have installed (but disabled) LoginTobbogan, since I thought these two modules didn't get along, but now I find this behaviour being Simplenews' only.

My goal here is to provde a checkbox so users who are registering can opt to subscribe or not to the newsletter. I've already seen the Simplenews' action trigger in which users would be subscribed automatically, without their consent, and this is not what I want particularly.


texts: How to create a theme date view with CSS styles?

texts:
I created my view (datev) that contains two field (date and description).
I renamed my template views-view-datev.html.twig and views-view-fields--datev---block.html.twig.
I already have my CSS but I do not know how to use my template theme.

I want it appears like this.


texts: Assigning non registered users as students to course content type

texts:
I have a content type course and I need to assign students ( nonregistered users ) to its nodes.

My students list contains only the names of students. I have tried signup module and Entity Registration module but both of them need the user to be a registered user.

Though Entity Registration module provides a way where I can create registrations, but an email is required.

My objective is to store the student names with each course and I can later  output the total number of students associated to a course node using views.

Any clues on this ?


texts:
I'm learning Drupal, and having a lot of fun. I am approaching the phase were I'd like to make my content more accessible to users.

I haven't implemented it yet, but I am really liking the ApacheSolr Search Integration module. I was wondering if there was any module to search within Views. My problem is that most of my site is based on Views; I have a lot of content on external databases, which I am maintaining, and Views queries that content for the users.

If Solr doesn't have anything I need, is there any other solution?


texts: View is rendered as "empty" even though the query returns results

texts:
I've got a Drupal View that I expect to return some results, but when I look at it (logged in as user 1), the empty result message is displayed. I turned on the setting which tells Views to output SQL in the preview. When I run the query directly against the database I get the expected result.

The View uses CiviCRM fields. I checked watchdog and the CiviCRM log for errors and found none.

The query looks like this:

SELECT DISTINCT <long list>
FROM {civicrm_contact} civicrm_contact
LEFT JOIN {civicrm_address} civicrm_address
  ON civicrm_contact.id = civicrm_address.contact_id
LEFT JOIN {civicrm_phone} civicrm_phone
  ON civicrm_contact.id = civicrm_phone.contact_id
LEFT JOIN {civicrm_value_agency_details_5} civicrm_value_agency_details_5
  ON civicrm_contact.id = civicrm_value_agency_details_5.entity_id
LEFT JOIN {civicrm_phone} civicrm_phone2
  ON civicrm_contact.id = civicrm_phone2.contact_id
WHERE ((
  (civicrm_contact.contact_sub_type IN  ('Agency'))
  AND (civicrm_address.city LIKE '%Brooklyn%' ESCAPE '\\')
  AND (civicrm_phone.is_primary <> '0')
  AND (civicrm_address.is_primary = '0')
  AND (civicrm_contact.is_deleted = '0')
  AND (civicrm_value_agency_details_5.accepts_food_donations_144 <> '0')
))
GROUP BY id

I am a little surprised it works at all; the id in the GROUP BY clause seems ambiguous.

Has anyone run into anything like this before? I am not too familiar with the Views codebase. Can anyone recommend where to throw in some debugging code to get a better sense of what's going on? Does Views do any post-query processing -- could it decide not to output what the query returns?


texts: How to convert a menu tabs in menu links block?

texts:
It would be very useful to be able to change the "tabs menu" in "menu links" to specific pages and users roles. In order to customize the UI.

I have not found any module for this.


texts: How to sort product displays by price using search api sorts?

texts: Actually I want to do the same behaviour as in commerce kickstart 2 for sorting my products by price. I'm using search api, search api db, search api sorts, search api ranges, commerce search api modules. I have created indexed node view with views and it is working fine. I can range nodes by price... I indexed the field "field_tshirt_commerce_price_amount_decimal_asc" with my node (my product type is called tshirt). And I want to see it in my sorts, but it just writes "There are currently no fields for which sorts can be displayed." Am I missing something?


texts:
I try to change a the theme template for one form. I do not want to use theme suggestions as I only want to use a different theme in one case, and if I add a suggestion, it is always used. (maybe I'm wrong.)

I'm doing:

in my controller:

$form = \Drupal::service('entity.form_builder')->getForm($entity);

$form['#theme_wrappers'][] = 'user_register_form_01';

return $form;

in my .module

function mymodule_theme() {
  return [
    'user_register_form_01' => [
      'render element' => 'form',
      'template' => 'user-register-form-01',
    ],
  ];
}

in user-register-form-01.html.twig:

<form{{ attributes }}>

  {{ form.field_1 }}
  {{ form.field_2 }}
  {{ form.account.pass }}
  {{ form.account.mail }}

  {{ form.form_build_id }}
  {{ form.form_id }}
  {{ form.actions }}

</form>

Everything seems to be rendered correctly, but the form does not work/submit. I think it is because attributes does not contain any action information. There is one more attributes variable inside form but I don't know how to call it as when I dump it it is prefixed with #

dump(form|keys) returns

array (size=49)
  0 => string '#attributes' (length=11)
  1 => string '#attached' (length=9)
  ...
  47 => string '#children' (length=9)

I don't know how to access this as form.#attributes doesn't work and form.attributes results empty.
Also this #attributes seems not to contain the needed form submission information. But it seems that inside #children the #attributes does.

I am thankfull for any hint or help.


texts:
I can't get a pagination working for my nodes...

What I've tried:
I tried to make a page view with views in which I had my youtube content type and the title. Then there was a pagination but first: It wouldn't apply the normal links of the nodes(veague-0, veague-1, and so on), when i click on "next", but rather the new name of the page(let's say it was "home" then it goes to "home-1" or something)... But the main problem was: The share links weren't there :-(...

I've tried the module smart pagination and it didn't work, it would always just show "" as plain text... I've already adjusted everything which has been told in the main post for smart pagination(https://drupal.org/node/1093856#comment-4223874)

The page I mean is the following:

http://veagues.com

I really appreciate any help.


texts: How to include the comment page number in views "rewrite results"?

texts:
I built a custom "new comments" notification system that doesn't rely on the history module (and the super slow queries when viewing nodes with new comments).

When I show nodes with new comments I need to rewrite the link to jump to the first new comment. "node/[nid]#new" does that. However, when I have a lot of comments and the first new comment is on the 2nd page (or higher) the link doesn't work. It would need to be "node/[nid]?page=1#new", etc.

I don't think the "page" value is available in views. Any tricks I can use?


texts: Populate node/add field from a entity reference field on the page?

texts:
I have several sub-content types that are tied together in one content type via entity reference fields.

What I'd like to do is display the fields of each content type (instead of using a modal to add nodes of the sub-content types) so I installed the inline_entity_form, which allows me to do this. It displays the fields from all the sub-content types on the main content node/add screen. Because this is for a financial app, the client would like to see all the fields at the same time and enter them in one go by tabbing. The issue is that I lose the entity lookup feature so they can't select from existing content, like applicants.

What I thought would work is if I add another entity reference field above my primary entity reference fields so users can select existing content and would hide the fields of the corresponding sub-content-type.

Is there a more graceful way to approach this issue?


texts:
I have a drupal 7 site I inherited to manage.  There is a view I can edit at /newsletters#overlay=admin/structure/views/view/newsletters/edit and it has a section titled "header" that I can't figure out how to enable for translations.  The section below it,"content", is showing up properly translated on the front end.

The menu for Header looks like this:

Clicking Edit Global: Text area reveals this:

What do I have to do to translate this and display it properly?


texts: Adding Paypal Express Checkout for multiple domains

texts:
I'm working with a multi-site setup (via Domain Access) and am having issues using Paypal Express Checkout on more than one domain.

What I have done so far:

Add a new Payment Method Rule with:

Event = Select available payment methods for an order
Rule = an existing component with a Domain Comparison element
Action = Enable Payment Method : Paypal Express Checkout

Edited the Action element to add in the updated Paypal payment settings (user, pass, Signature)
Ensure Rule is active

This does not add the Paypal Checkout button to /cart like I expected.

For testing, I edited the component for the domain that does have it and used the new domain for the Domain Comparison.  This did add the Paypal button to the second domain.  The only differences between these rules:

The component used in the rule has a different domain
The payment settings (user, pass, signature)
The original one has a status of Overridden whereas the new one has Custom

I appreciate any suggestions for troubleshooting the issue - let me know if you need more information!

Chris


texts: How to get the attachment display of a view to show up in a PDF display (created using Views PDF module)?

texts:
I have a view with the following displays in a single View on my Drupal 7 website:

Page
Attachment 1
Attachment 2
PDF

The Attachment 1 and 2 displays both are set to be shown on the Page display, based on contextual filters and relationships. This is working great, but I'm not sure how to include all fields from the Page as well as the fields from the Attachments when creating the PDF display (using the PDF Views module), since they are all part of the same View. Is it possible to do so?


texts: redirecting midway out of a webform wizard

texts:
I am building a webform that has multiple pages. The idea is that the user leaves the wizard after each page that he submits. When he later returns, he automatically starts the form on the unanswered page.

The reason for this behaviour is that doing so, we can keep the records of all the 'sub-surveys' together as one single submission.

I successfully have set up custom handlers based on the example module. I can see that the handler is working.

To accomplish the desired scenario, I thought that it is probably best to log the user out in the {submitForm} function of the handler and set the redirect ($form_state->setRedirect).

The redirect doesn't happen, but the logout does. What I end up with now, is that the user sees his next page, but can't submit it because he is actually logged out. It's fine that he can no longer submit. But it's not ideal that he sees the next page in the form. That is why i try to redirect.

I read in another question on stackexchange that the redirect should be set in the confirmForm, but that doesn' work either. Maybe because confirmForm only happens at the end of the wizard or something.

Any suggestions on how to redirect after (each, or some based on a condition) pages from the wizard?

Thanks.


texts: Drupal visualization with highcharts, how to set size

texts:
I'm trying to write a module that is implemnting a block containing a pie chart. The pie chart is implemented using visualization together with highchats.

It displays the pie chart at the moment but it is to big for my site. Does anyone know how to set the overall chart size?

I downloaded visualization three days ago but I've not been able to patch the module with visualization-more_control-1809850-13.patch (see https://www.drupal.org/node/1809850) unfortunately..

Here is the option array I use in my module.

  $options_pie = array(
           'title' => t(''),
           'fields' => array(
                     'antal' => array(
                              'label' => t('Amount'),
                              'enabled' => TRUE,
                              ),
                     ),
           'xAxis' => array(
                    'labelField' => 'certificate',
                    ),
           'data' => $data,
           'type' => 'pie',
           );


texts:
Following configuration: Drupal 7.31 / Theme: Tb Corpal (based on nucleus 7.x-1.5)

I am using views to configurate what is shown on the frontpage. Format is "Grid".

Please have a look at the page: www.reatch.ch

You will notice, that the first three teasers are shown right below the slideshow. Then there is a huge vertical gap to the fourth teaser. After the fourth teaser there is another huge vertical gap to the footer.

I am not sure why this happens. Did not find an option in views which enabled to change that... Please let me know what other information you need to answer this!


texts:
When users sign up, I create a new node and add that user into one of the entity reference fields through rules.
What I built so far is the following.

After saving a new user event
Create a new content item action (Parameters: type: advisor_student_matching_program, title: title comes here)
Set a data value (Parameters: data: node_created.field_university_student, value: @user.current_user_context:current_user)
Save entity (Parameters: entity: node_created, immediate: 1)

Everything works fine except for the third step.
uuid: 692696f4-4c6d-45cc-8a5b-3b69f1925bd0
langcode: en
status: true
dependencies: {  }
id: register_university_student
label: 'Register University Student'
events:
  -
    event_name: 'rules_entity_insert:user'
description: ''
tags: {  }
config_version: '3'
expression:
  id: rules_rule
  uuid: 6f4c1ccb-973c-48ec-aed1-637bdb50e301
  weight: 0
  conditions:
    id: rules_and
    uuid: 3f479a19-06b2-4e05-80c2-4cff28650409
    weight: 0
    conditions: {  }
  actions:
    id: rules_action_set
    uuid: abbb62e5-a610-4ab7-8e3a-f96a4570f049
    weight: 0
    actions:
      -
        id: rules_action
        uuid: 3bce44f5-accb-4239-9c1d-377f29debebf
        weight: 0
        context_values:
          type: advisor_student_matching_program
          title: 'title comes here'
        context_mapping: {  }
        context_processors:
          type:
            rules_tokens: {  }
          title:
            rules_tokens: {  }
        provides_mapping: {  }
        action_id: 'rules_entity_create:node'
      -
        id: rules_action
        uuid: eba88823-1ab3-493a-9b62-e22e49a2db4a
        weight: 0
        context_values: {  }
        context_mapping:
          data: node_created.field_university_student
          value: '@user.current_user_context:current_user'
        context_processors: {  }
        provides_mapping: {  }
        action_id: rules_data_set
      -
        id: rules_action
        uuid: 779eadc9-f208-4cfa-b37e-351126c56243
        weight: 0
        context_values:
          immediate: '1'
        context_mapping:
          entity: node_created
        context_processors:
          immediate:
            rules_tokens: {  }
        provides_mapping: {  }
        action_id: rules_entity_save
      -
        id: rules_action
        uuid: 18d0c0d6-d9c6-4fc9-8127-4291fe80081c
        weight: 0
        context_values:
          url: /register-uni-basic-information
        context_mapping: {  }
        context_processors:
          url:
            rules_tokens: {  }
        provides_mapping: {  }
        action_id: rules_page_redirect


texts: How to add select years and months select Drupal 8.1 date picker?

texts:
There is no configuration option available in the backoffice nor from configuration synchronisation variables that allows to edit the settings for the jQuery datepicker widget embed in core.

My question is: how to select years and months in Drupal 8 core's date picker widget ?

By default years and months can only be changed by slowly navigating through adjacent months with left and right arrows.


texts:
For a client's website I have these URLs:

library
library/{category}

I have a ParamConverter to verify that {category} is correct and return the taxonomy term. And each URL requires a "view library" permission which anonymous doesn't have.

The client's requirements are that 404 errors redirect the user to the  login page if not logged in.

I created a RedirectOn404Subscriber event subscriber to handle the 404 and redirect as needed. (I have tested it with a logged-in user and can redirect using this.)

When not logged in the redirection works fine for any obvious URL error:

example.com/xxxxx

And works for these:

example.com/library
example.com/library/valid-category

But this does not redirect:

example.com/library/invalid-category

It generates the 404 error but does not hit the redirect code.

It's as if it's not executing the ParamConverter when it's wrong - but it can't know that until it's executed the code...

Clearing caches just prior to a test does not alter the behaviour.

UPDATED TO INCLUDE CODE

404 redirect...

  /**
   * Prevents this being called when it's not an HTML request.
   *
   * @return array
   */
  protected function getHandledFormats() {
    return ['html'];
  }

  /**
   * Specifies the priority of all listeners in this class.
   *
   * The default priority is 1, which is very low. To have listeners that have
   * a "first attempt" at handling exceptions return a higher priority.
   *
   * @return int
   *   The event priority of this subscriber.
   */
  protected static function getPriority() {
    return 750;
  }

  /**
   *
   *
   * @param GetResponseForExceptionEvent $event
   */
  public function on404(GetResponseForExceptionEvent $event) {
    if ($this->currentUser->isAnonymous()) {
      // Any 404 when not logged in, return to front page.
      $route_name = '<front>';
    }
    else {
      // Any 404 when logged in, return to base page for user.
      #$route_name = 'user.page';
      return;
    }

    $query = $event->getRequest()->query->all();
    $redirect_uri = Url::fromRoute($route_name, [], ['query' => $query]);

    $returnResponse = new RedirectResponse($redirect_uri->toString());
    $event->setResponse($returnResponse);
  }

403 redirect...

  public function on403(GetResponseForExceptionEvent $event) {
    $request = $event->getRequest();
    $is_anonymous = $this->currentUser->isAnonymous();
    $route_name = $request->attributes->get('_route');
    $is_not_login = $route_name != 'user.login';
    if ($is_anonymous) {
      if ($is_not_login) {
        $query = $request->query->all();
        $redirect_uri = Url::fromRoute('<front>', [], ['query' => $query])->toString();
      }
      else {
        // Do not redirect, this is an anonymous login.
        $redirect_uri = NULL;
      }
    }
    else {
      // Any 403 when logged in, return to base page for user.
      #$redirect_uri = Url::fromRoute('user.page')->toString();
      return;
    }

    if (!empty($redirect_uri)) {
      $returnResponse = new RedirectResponse($redirect_uri);
      $event->setResponse($returnResponse);
    }
  }


texts:
I have a Site with a Twig Template. I have an multiple entity references which I want to loop trough and print out the name, description of each entity.

In my template I'm using the following code to loop through entities.

{% for item in node.field_workers %}
 {{ item.entity.field_name.value }}
{% endfor %}

This loops trough all my entities but won't output any value whatsoever.
I tried using kint() to debug the process. When I try kint(item.entity) it shows me the following structure:

protected fields --> field_name

When I try kint(item.entity.fields) it redirects me to 'drupal/install' page when I try to load the page.

What am I doing wrong?


texts: I am trying to modify a form element using hook form alter but I can't find the correct field name

texts:
I am learning Drupal 7. I have a custom module, trying to modify a date form element in my page. I have the form id identified, and Devel module list me all the fields in this page, I think I am typing the correct field name but it doesn't work, It creates a new form element instead of modify the form element.
Maybe the element is inside a fieldset, but I don't know how to write the correct line to modify. It is a datepicker and I am trying to modify the minDate property for the date element.

Here is my code:

function davidcustom_form_alter(&$form, &$form_state, $form_id) {
  drupal_set_message($form_id);  // print form ID to messages

  // Check when the right form is passed
  if ($form_id == 'commerce_cart_add_to_cart_form_24296') {

    $form['field_line_item_fecha_reserva'] = array(
      '#title' => t('Pick the desired date'),
      '#type' => 'date_popup',
      '#datepicker_options' => array(
        'minDate' => 10,
      ),
    );

  }

}


texts:
I am writing PHP code in a rule, where I include another PHP file.

include_once 'google-api-php-client/src/Google/autoload.php';

Where do I need to include files?


texts: do i need to check expiration cache in drupal from cache_get?

texts:
I'm using drupal 6 and I've build table that is similar to cache (hook_schema) for using it with function cache_get/cache_set.
I just want to be sure how things should work in drupal.

To clean the table I'll need to use hook hook_flush_caches() where I'll decide if i want to clear expire data or whole cache? hook_flush_caches is called on cron?
In case I'll need to check data expiration by second, I'll need to do manually after cache_get function ?

This is kinda confusing...


texts:
Is there any way to provide a different node ID per language for the front page setting in Drupal 8?

We need a different front page for a specific language. In Drupal 7, this was easy.


texts:
I have faced a new problem, here I have poll block which is already displayed for administrator or user who has the permission of "view published content". When I made another user and give the complete permission for the poll but does not giver the permission of "view published content", it is not displayed for the user. Can any one help me to show that in the block for user except administer or user who has the permission of "view published content".

cheers


texts:
Following the Form generation example from DrupalAPI (https://api.drupal.org/api/drupal/core!core.api.php/group/form_api/8.1.x), I have an error when I call the form in my template_preprocess_node.

Here's my code.

mymodule/src/Form/ExampleForm.php

namespace Drupal\mymodule\Form;

use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;

class ExampleForm extends FormBase {
  public function getFormId() {
    // Unique ID of the form.
    return 'example_form';
  }

  public function buildForm(array $form, FormStateInterface $form_state) {
    // Create a $form API array.
    $form['phone_number'] = array(
      '#type' => 'tel',
      '#title' => $this->t('Your phone number')
    );
    return $form;
  }

  public function validateForm(array &$form, FormStateInterface $form_state) {
    // Validate submitted form data.
  }

  public function submitForm(array &$form, FormStateInterface $form_state) {
    // Handle submitted form data.
  }
}

mytheme/mytheme.theme

function cmimmo_preprocess_node(&$variables) {
  $variables['simulator_form'] = \Drupal::formBuilder()->getForm(\Drupal\mymodule\Form\ExampleForm::class);
}

I get the following error:

  InvalidArgumentException: The form argument Drupal\mymodule\Form\ExampleForm is not a valid form. in Drupal\Core\Form\FormBuilder->getFormId() (line 190 of core\lib\Drupal\Core\Form\FormBuilder.php).

Why am I getting that error message? What is wrong with my code?


texts: After moving Drupal 7 site, adding /user or /?q=user to base URL simply reloads maintenance page

texts:
I've just moved a Drupal 7 site from Bluehost to Inmotion (by reinstalling the latest core and adding the 'sites' directory from the old server account, then uploading the database). Since the move I can't log in from the browser.

The DNS has transitioned. At the new location Drupal is installed in a subdirectory -- public_html/sub. I've altered the .htaccess file at the level above (public_html/.htaccess) as per these directions https://support.lunarpages.com/knowledge_bases/article/549 so that the site will open there with the base url in the browser.

That does happen, with the base URL currently showing the under maintenance message, just as the site was left. But when I attempt to go to /user or even /?q=user to log in and resolve any last errors from the move, then bring the site back online, I am not given a login form. It simply continues to show the under maintenance message.

I'm guessing this problem is somehow related to .htaccess and/or settings.php, but I can't seem to find the right combo of changes that will allow me to log in. Any suggestions? (I did clear the cache and sessions tables in the DB when this error first occurred, but no help.)


texts: Customizing the register form with a new class: Why do I get this error?

texts:
I'm trying to customize the register form. A user has a reference field to content of type A. However, I only want to allow values of A which satisfy a certain condition.
To achieve this, I based my code on https://www.foreach.be/blog/how-manipulate-forms-drupal-8.

I created a module with the following services.

services:
  travels.route_subscriber:
    class: Drupal\travels\Routing\RouteSubscriber
    tags:
      - {name: event_subscriber }

I defined a RouteSubscriber class.

class RouteSubscriber extends RouteSubscriberBase {

  /**
   * {@inheritdoc}
   */
  protected function alterRoutes(RouteCollection $collection) {
     if ($route = $collection->get('user.register')) {
        $route->setDefault('_form', '\Drupal\travels\ExtendedRegisterForm');
     }

   }
}

I also have an ExtendedRegisterForm class defined as follows.

class ExtendedRegisterForm extends RegisterForm {
     public function buildForm(array $form, FormStateInterface $form_state) {
         $form['test'] = [
            '#type' => 'email',
            '#default_value' => 'test'
          ];
         return $form;
      }
}

If I load the page to register a new user, I get the following error:

  Fatal error: Call to a member function getEntityTypeId() on null in xxxx\core\lib\Drupal\Core\Entity\EntityForm.php on line 77

I'm assuming no entity was given because the Entity still needs to be created (after the registration). Does anyone have a suggestion of what I might still need to do to get this working?


texts: Loading default image from a node field in page.html.twig

texts:
I want to print the default image of a node field into the page.html.twig template file in Drupal 8. On doing my research the easiest approach I could find was

{% if node.field_image.entity %}

{% endif %}

This works if I load an image in the field but not otherwise with the default image of the image field. I want to use the above code to print the default image that I pick for this image field. Currently the above method gives  for the default image

How can I access the uri value of the default image in the src of the image tag above. Is there any other way to print the default image of a node in the page.htm.twig preferably from within the template layer as I don't have any experience with preprocess functions etc.? My objective is to have a static image which is the same throughout the content type.


texts:
I've got a question about webform and webform validation.

I'm in D6.19 with webform 6.x-3.4 and webform validation 6.x-1.3

I'm adding a date field to capture age, and I need to validate that the age of the user is at least 13 years from current date.

Does anyone know how I can do this?
Thanks
Stephanie


texts: Why timestamp format was chosen for users.created field

texts:
When I looked into users.created field in the database, it says, that is has type int. Does anybody know, why Drupal team chose this format instead of datetime? Cause timestamp will end with the end of UNIX epoch:

http://en.wikipedia.org/wiki/Year_2038_problem

As they are setting it to this value:

$account->created = REQUEST_TIME;

http://api.drupal.org/api/drupal/includes!bootstrap.inc/constant/REQUEST_TIME/7

And datetime is unlimited. So, why was this inferior variant chosen?


texts: How do I calculate the days difference between start and end date of a date range field in Views PHP?

texts:
I'm trying to get the total number of days in a date range field using Views PHP. Any help will be greatly appreciated.

I tried the code below first in "value code" then in "output code" but it didn't do anything.

$start = strtotime($row->field_start_and_end_date:value);
$stop = strtotime($row->field_start_and_end_date:value2);
$days = $stop-$start;
echo $days;


texts:
I've been trying to create a user via webservice without doing any custom coding or curl.
This post got me 75% there: How to create test_endpoint?

I finally got it working, but only by passing in my creds with each request.  CSRF token header is ignored.

I'm using the Services and Services basic authentication modules.

I do an initial GET request to services/session/token with Basic auth headers with my username/password and get the token as expected.
In the next call, POST to rest/user, I have the CSRF token (HTTP_X_CSRF_TOKEN) and Content-type (application/json) and json encoded user data in the body.  Instead of authenticating with the token, I get a login popup.

If instead I send the Basic auth headers with my username/password along with the create user request and json data, it works.  I don't understand why CSRF is being ignored.

Thoughts?

Edit:  One other note.  In testing I used both the FF RestClient and FF Poster plugins.  I have not tested on Chrome.


texts:
I am developing a site on my localhost. I used WAMP but it takes too long to load pages from time to time. Something like 20 seconds execution time according to devel. Not on every page, not every time, but happens often enough to disrupt any kind of work I am trying to do.
After no much success in debugging the problem I decided to try "DAMP" the Acquia stack for Drupal.

The difference is enormous- execution time is less than 1000 ms, which although much is something workable for dev. stage; Memory used peaks at 12 MB instead of 50 in wamp.

Still there is this problem of pages not loading fully. When I click on a link the browser shows that it is "connecting" and it will stay like that indefinitely (takes more than 2 minutes to time out), but if I interrupt and refresh the page loads instantly (100-300 ms)
This again would be acceptable if it didn't interfere with my work. I can't add or delete content because of this. It just stays on "connecting" and on refresh it hasn't made the action.

So my question is what makes acquia stack not finishing the page loads and wamp server to be so damn slow?

I am talking about drupal 7, hardware shouldn't be an issue (Core 2 duo at 3.1 Ghz, and 3 GB RAM, somewhat old, but still kicking)


texts: Is there an error in Drupal with hook_views_post_execute?

texts:
In D8 I would like to sum a field in a view within a custom module called nvgh.
I choose to use a hook for a start. I'm not sure this will be the good hook anyway.

https://api.drupal.org/api/drupal/core%21modules%21views%21views.api.php/function/hook_views_post_execute/8.6.x

function nvgh_views_post_execute(ViewExecutable $view) {

  if ($view->total_rows > 12) {
    \Drupal::messenger()
      ->addStatus(t('You have more than 100 hits. Use the filter settings to narrow down your list.'));
  }
}

I directly get an error:

  The website encountered an unexpected error. Please try again later.
  TypeError: Argument 1 passed to nvgh_views_post_execute() must be an
  instance of ViewExecutable, instance of Drupal\views\ViewExecutable
  given in nvgh_views_post_execute() (line 96 of
  modules\custom\nvgh\nvgh.module).

a) Is this a bug in Drupal 8?
b) Which hook is common to use for pseudo code like

for each row in view result

count a field
display a message


texts: Custom migration not appearing in the migration UI

texts:
I wrote a custom migration module, and I have enabled it in the Drupal 7 administration pages. I have searched through the web, but nothing shed any light on my issue. I came across this post, but it was not helpful.

I have under sites/all/modules/my_module the following 4 files:

my_module.info (contains the necessary info and included .module and .inc files)
my_module.module (contains my_migration_migrate_api())
my_user_migration.inc (contains class MyMigration extends Migration)
my_module.install (empty file by looking at online examples - http://btmash.com/article/2011-02-25/migrating-content-using-migrate-module)

I apologize, but I really don't know how I could be more specific with my question. Does anyone know what could be wrong?


texts: Taxonomy drag and drop for only 2 levels

texts:
I've created a vocabulary, I can add terms but I want to "configure" this taxonomy to add terms with only 2 levels.

I'm talking about the default table that show my vocabulary terms (drag and drop system). How can I make it set only a term and sub-terms (disable sub-sub-...-subterms)?

I've tested the select module but as long as I can add multiple hierarchic terms, the select module add them as well, so it's not the solution

Thank you all


texts: Paginate results of entity reference widget type

texts:
I have entity reference field with checkboxes/radio as the widget type. The issue is the I have hundreds of nodes and this results in a having a big list. Is there a way to paginate the results or have a "load more" button/link which loads more results via ajax?

I should mention that I tried the entity_view_widget module but had other issues with it and can't really use it for this project.


texts: Can drush make fetch dependencies for a newly added module, without using it to build the whole site?

texts: If a module includes a drush make file to fetch its dependencies, is it possible to run that make file by itself somehow against a pre-existing site's codebase? In other words, I didn't use drush make to build the site, but I'd like to use it just to fetch the new module's dependencies. Is that possible?


texts: How do I add a view with a module when installing a module?

texts:
In Drupal 8, I want a view to be created when a module is installed.

I have already used the Features module to export the view, so I have the yml file that creates the view. I can't find what to include in order for this view to be created on installation of my module.

How can I achieve this?


texts:
I am trying to sketch out a Drupal 8 based solution by which content is authored in a modular way, with an arbitrary number of different modular blocks of content,  that would also allow nodes to be pushed (or pulled) to other separate Drupal 8 installs. (The essential idea being that a set of editors have access to a set of simple modular blocks to build content which is likely to be duplicated across different separate sites and another set of editors have access to a more complicated set of blocks to build content that is not necessarily meant to be duplicated.)

So far I can't seem to find any obvious solutions, most seem to require knowledge of the content configuration beforehand. Is there an obvious solution I'm overlooking or just ignorant of?

A combination of Paragraphs and Deploy module have been suggested to me. I'm still evaluating their combination to determine if it's suitable but any additional suggestions would be very helpful!


texts: How to override node clone to its parents node?

texts:
I am using node clone 7.x-1.0-rc2 module.It is creating clone for a particular node.Now if i published clone.How to override parent node with clone node. Is there any other way or module for doing this?

I am using workbench and my scenario is that i have three types of user contributor,validator and publisher. only contributor can create node and assign it to validator, now here validator can revert to contributor or assign to publisher.Publisher can publish this node or revert to validator.Now i am creating a clone of this node and again send it to contributor and contributor send it to publisher but when publisher wants to publish this clone so old content get update this clone node's content or delete old one and become this node as a parent node.


texts: Default language problem on multilingual website

texts:
I have a problem with default language. I have 2 languages (English and German), and the l18n module installed. The default language is English. I have added a content in English, and I translated it with Translate option. The path for the English content is en/content/article, and the path for German content is de/content/article.

After changing term translations, the language content is changed to German, while the default language for the site is still English. When I want to edit or add new content, that is in German (de/content/article), even if I set English.

I have German as default language in the content list; previously, it was English.

Can anyone help?


texts:
I'm using Drupal 7 and I'm trying to create an image style, which resizes and crops an image and adds another image as the background. The latter image is the canvas for this image style. I am using the Imagecache module and so far I tried either adding the canvas image as "Underlay (background)" or as "Overlay (watermark)", but with either of these selections the problem is that the background image and the front image are positioned at x:0, y:0, and the result is not what I want, meaning both image are on top of the other.

Is there a way to define an offset for the image I want to be inside the canvas image? Otherwise, is there another way of doing this?

Please let me know if I didn't express my question clearly.

Thank you!


texts:
I am having trouble grouping a view table style on taxonomy terms.  It is rendering like

TAGS: tall
ITEM        TAGS
One         tall
Two         tall
Four        tall

TAGS: tall, soft
ITEM        TAGS
Three       tall, soft
Three       tall, soft

and I would really like it to render

TAGS: tall
ITEM        TAGS
One         tall
Two         tall
Three       tall, soft
Four        tall

TAGS: soft
ITEM        TAGS
Three       tall, soft

Drupal7, by the way.


texts: Calling Jquery function from link onClick attribute

texts:
I'm trying to call a jQuery function from a link's onClick attribute but I get the following error: Uncaught TypeError: Drupal.behaviors.main.test is not a function.

I created a simple module that will create a block displaying a list of events. The block template will output the following HTML code:

Event1

Event2

Each link has a onClick attribute calling Drupal.behaviors.main.test($id).

On my theme's info file, I include a test.js file with the following code:

(function ($) {
    Drupal.behaviors.main = {

        attach: function(context, settings) {

            $(function test() {
                console.log('yo')
            });

            $('#home').slick({
             //init slick
            });

       }
    }
})(jQuery);

When the document is ready, slick plugin is well initialized and test() is called so I get 'yo' on the console. It's when I click the links that I get the error, so I'm thinking about a scope problem since the function is called from a module but is defined on my theme.
Does anyone have any idea?

Thanks in advance!

--EDIT--
Thank to rémy, I managed to resolve my issue, here's what I did:
My block outputs the following HTML:

        Event1

        Event2

And on my test.js file:

(function ($) {
    Drupal.behaviors.main = {

        attach: function(context, settings) {

            $('.whatever').click(function() {
              console.log(this.id);
            });

            $('#home').slick({
             //init slick
            });

       }
    }
})(jQuery);


texts:
How can show block when mouse over icon in menu like this

when i put mouse in any link in this menu its show me block.

How can i do this.


texts: Webform tokens - token to return the 'option value' not 'option text'

texts:
I am trying to pass the value of fields from one wizard page to another page . I can use the [Webform_submission:values:element_key] to pass most values. However on the select list I want the 'option value' not the 'option text'.
Example using the twig
  Example:
   '#options':
     10: Ten
     20: Twenty
     30: Thirty
     40: Forty
     50: Fifty

if the second item is selected I want the value "20" not "Twenty"

Is there a token that will give me the other value?


texts: how to display Variables in User account page

texts:
In the node template, I used to put the following code to find the variables:

<?php print_r($node) ;?>

What if this is a user account page (e.g. /user/1), what "$object" should I print to see the variables. I need to pre-fill the webform's fields with the profiler2's fields.


texts:
I'm trying to delete a node knowing it's nid.

I've implemented hook_cron in order to do this:

function my_module_cron() {
  node_delete(5446);
  print "deleting node 5446";
}

The print message it's shown when executing the hook_cron, so I assume it also executes node_delete.

But the node it's still there in the website and also in the DB.

Other alternative would be manually deleting the node from the DB using the queries that appear in the node_delete code

Would this be enough?

Could it broke something doing this manually instead of using node_delete?

I call the hook_cron using drush:

drush --uri="www.myurl.com" php-eval 'my_module_cron();'


texts:
I have written a module that puts a "generate pdf" link on a node when it is viewed. What I now want to do is lock the original node after the pdf is generated.

I know I could just add a "locked" field to the content type I want to lock, and then programatically set that etc. But I'd prefer it to work with any content type.

How can I programatically disable the editing of a node? I'd prefer to install as few additional modules as possible.


texts: How to avoid data loss for non translatable fields if original language is deleted?

texts:
A small scenario to describe an issue:
I have a CONTENT TYPE with 5 fields.
Steps followed:

Go to admin/config/regional/content-language.
Enable translation for only 2 fields.
Then created a node in the german language(original language) and also added translation for the FRENCH language.

Now my site doesn't require the German language(original language). So if I remove the german language completely from the site then I lose data for the non-translatable fields which were initially added in the german language.
Above issue occur for all entities. Is there any way I can remove language without losing any data?


texts: Editing own content for content type giving me access denied

texts: For content type "XYZ" for a user that has "Edit own XYZ" content I get an access denied message when attempting to edit content that was created by user. Do I need any further access permissions? I can delete and view my own content, just not edit.


texts: Re-writing View Comment link to display node title

texts:
I'm trying to re-write the [view_comment] field in a Comments View with the [title]. I have the [title] excluded and I'm re-writing [view_comment] with [title].

What I'm hoping is to show the node title in the view and it will link to the latest comment on the node. I think I need to 'output the [view_comment] field as a link' possibly with node/???? (or similar) as the absolute link.

Can anyone point me in the right direction?


texts:
I've followed all instructions to the letter, including those in various fixes mentioned in search results for this specific issue.  I'm still getting an error.  The install script seems to work all the way through the final step, which calls for setup of the admin account.  Once I complete that form and click to continue, I get the following error message:

The requested page "/install.php?profile=standard&locale=en" could not be found.

Examples of fixes mentioned elsewhere include turning off opcache and changing the database collation.  I'm installing on a shared Linux platform that more than meets the system requirements.

Why does install.php result in a "Page not found" error?


texts:
On a Drupal 7 Webform I've added a button using a markup field like this:

<button name="get" value="" type="submit" class="primary-submit submit" id="get">
Get Address
</button>

I am directing it to a submit handler like this:

function new_webform_form_alter(&$form, &$form_state, $form_id) {
  if ($form_id == 'webform_client_form_88') {
    $form['submitted']['name']['get']['#submit'][]='new_webform_get_submit';
    dpm($form);
  }
}

I can tell the button #submit is being changed, but the whole form is submitted instead of executing the handler code. What am I doing wrong?


texts: Can't update radio button fields after ajax callback

texts:
I'm having troubles with a FORM in Drupal 8, the idea is:

Chose a radio value from radio-estaciones to recharge radio-contaminantes, but, after the callback, the result I see is empty, but in replace command I use, I see it correcly

This is the code of buildForm

public function buildForm(array $form, \Drupal\Core\Form\FormStateInterface $form_state){

    $arrRadioContaminantes = array();
    $arrRadioContaminantes["0"] = t("ALL");

    //My function to access DB
    $result = \Drupal\map_data\Controller\Contaminante::list();
    foreach ($result as $it){
        $arrRadioContaminantes[$it["id_contaminante"]] = t($it["description"]);
    }

    $form['radio_contaminantes'] = array(
        '#type' => 'radios',
        '#options' => $arrRadioContaminantes,
        '#ajax' => [
            'callback' => '::seleccionContaminantes',
            'disable-refocus' => true,
            'event' => 'change',
            'wrapper' => 'radios-estaciones',
            'method' => 'replace'
        ]
    );

    $form['radio_estaciones'] = array(
        '#type' => 'radios',
        '#id' => 'radios-estaciones',
        '#options' => ['-1'=>t("SELECT CONTAMINANTE FIRST")]
    );

    $form['actions']['#type'] = 'actions';
    $form['actions']['submit'] = array(
        '#type' => 'submit',
        '#value' => $this->t('Submit'),
        '#button_type' => 'primary',
    );

    $form_state->setCached(false);
    $form_state->setRebuild(true);

    return $form;
}

This is callback function:

public function seleccionContaminantes(array &$form, FormStateInterface $form_state){
    if($form_state->getValue("radio_contaminantes") != 0){
        $form['radio_estaciones']["0"] = t("All");
    }

    //My Database function
    $resultado = \Drupal\montar_mapa\Controller\Estacion::list($form_state->getValue("radio_contaminantes"));
    foreach ($resultado as $it){
        $form['radio_estaciones'][$it["id"]] = t($it["name"]);
    }

    $ajaxResp = new AjaxResponse();
    $ajaxResp->addCommand(new \Drupal\Core\Ajax\ReplaceCommand('radios-estaciones', \Drupal::service('renderer')->render($form['radio_estaciones'])));

    return $ajaxResp;
}

I try returning $form['radio_estaciones'] with same results, and try DataCommand pasing new values, same result... I need help


texts: How to get the installed version of a module?

texts:
We have a "MyModule" module, which has a mymodule.install.
Inside the file, there is mymodule_update_8001, 8002 ... etc.

How can I tell programmatically that on which version the module has at the moment?
I know where to find them in database (key_value table), but I would like to use a service instead, if that's possible.

The closest I found:

$update_hook_count = \Drupal::keyValue('system.schema')->get('mymodule');

This returns the update hook number.


texts: How to group content in view by taxonomy terms?

texts:
I have a content type called blogs and in which I referred a Taxonomy term which have three different terms in it.
Now what I want to achieve is three blocks with two recent posts for each taxonomy term.
Which should look like :
||       TERM 1            ||          TERM 2           ||        TERM3        ||

         title1                        title1                     title1
          desc                          desc                       desc

         title2                        title2                     title2
          desc                          desc                       desc

         read more...                  read more...              read more...

I know we can create using seperate blocks each.
I need this to be created in a single block in views if this is possible.
I've tried group by in field settings, but it yields me something like this:
TERM 1

title1
desc

TERM 2

title1
desc
title2
desc
title3
desc

TERM 3

title1
desc

Since I specified 6 nodes to be displayed it displays 6 recent post irrespective of the taxonomy term.


texts: Rules: Data comparison between saved and unchanged node doesn't work with radio buttons

texts:
I successful used the data comparison on rules condition between saved and unchanged node for a date field.

I tried the same with a radio buttons list with two options, but the rule doesn't trigger if I change the value after saving the node.

What's wrong?

Here the rule: http://kopy.io/6GfFi  and here is an instream copy of it:

{ "rules_last_day_of_work" : {
"LABEL" : "Last Day of Work",
"PLUGIN" : "reaction rule",
"OWNER" : "rules",
"REQUIRES" : [ "rules", "interval", "rules_conditional" ],
"ON" : { "node_update--job_contract" : { "bundle" : "job_contract" } },
"IF" : [
  { "NOT data_is" : {
      "data" : [ "node-unchanged:field-date-of-last-day-of-work" ],
      "value" : [ "node:field-date-of-last-day-of-work" ]
    }
  },
  { "OR" : [] },
  { "NOT data_is" : {
      "data" : [ "node:field-resignation-layoff" ],
      "value" : [ "node-unchanged:field-resignation-layoff" ]
    }
  }
],
"DO" : [
  { "drupal_message" : { "message" : "test" } },
  { "data_calc" : {
      "USING" : {
        "input_1" : [ "node:field-days-of-notification" ],
        "op" : "*",
        "input_2" : "-1"
      },
      "PROVIDE" : { "result" : { "days_of_notification_negative_sign" : "Days of notification with negative_sign" } }
    }
  },
  { "interval_apply" : {
      "USING" : {
        "interval" : [ "days_of_notification_negative_sign" ],
        "period" : "day",
        "date" : [ "node:field-date-of-last-day-of-work" ]
      },
      "PROVIDE" : { "date" : { "notification_date" : "Notification Date" } }
    }
  },
  { "CONDITIONAL" : [
      {
        "IF" : { "text_matches" : {
            "text" : [ "node:field-resignation-layoff" ],
            "match" : "L",
            "operation" : "starts"
          }
        },
        "DO" : [
          { "data_set" : {
              "data" : [ "node:field-layoff-date" ],
              "value" : [ "notification-date" ]
            }
          },
          { "data_set" : { "data" : [ "node:field-resignation-date" ] } }
        ]
      },
      { "ELSE" : [
          { "data_set" : {
              "data" : [ "node:field-resignation-date" ],
              "value" : [ "notification-date" ]
            }
          },
          { "data_set" : { "data" : [ "node:field-layoff-date" ] } }
        ]
      }
    ]
  },
  { "redirect" : { "url" : "[node:url]" } }
]
}   }

THE ANSWER IS:
this is the way to put two condition in "OR"

and NOT this one:


texts: Rate content and attribute points to author

texts: I am looking for a module that allows users to be rated points +1 -1 . Any suggestions?  I would like individual users to be rated like stack exchange. I would also eventually like to have a rating for a node, e.g. project which also contributes to the user's points.


texts: How to add multiple meta tags with the same property?

texts:
I'm trying to set up OpenGraph tags on a page containing a video.  I'm currently setting up the usual sorts of <meta property="og:video"...> tags with calls to drupal_add_html_head(), and that's generally worked fine.  The problem is that I'm encoding the video in both .mp4 and .webm formats, so it seems like there should be META tags for both mp4 and webm versions

This is where drupal_add_html_head() seems to break down.  I've tried using it to set up both tags but only the last version entered shows up on the page -- the second call seems to be clobbering the first.  I've tried assigning different weights to the different elements, but with no success.  Any advice out there?  Thanks!


texts:
Using Drupal version - 8.7.4. Added a 'Text (plain, long)' field for news summary to news content type.

There is a news view that shows all recent news items with the summary.

I created a new news item and pasted the summary from a document from Google Drive.

The apostrophe shows up as &#039; on the view but in the drupal edit page, it shows a '

Any thoughts on why this is happening? Any solutions? I am completely clueless. Thanks for reading.


texts: View with same URL as node using Pathauto

texts:
I have a view with the URL of /characters and nodes with URL's in the form of /characters/12/title-of-character. When I visit the main view URL everything works, and all nodes are listed. When I visit the specific node URL however, I'm  shown the default frontpage.

I have no idea what's going on here and I'm breaking my head over this issue. Any help is much appreciated.


texts: 'After update' event firing when node is deleted

texts:
I have a rule set up that uses the following action:

  After updating existing content of type

It's working fine when a node is updated, but I just discovered that this rule also fires when nodes of the specified type are deleted. This makes sense, since changing the status of a node is technically an update, but this is not the desired effect as emails should not be sent when the node is deleted.

I added a small chunk of PHP inside the email generated by the rule to see what the value of $node->status is in this rule, but it is still 1, not 0 as I expected.

How can I use the 'After updating existing content of type' event, but not have it react when a node of that type is deleted?


texts:
I want create a custom token to retrieve all parents with a specific type of a menu item.

I have created a custom module with that :

function mytoken_token_info() {
    $info['tokens']['node']['team_url'] = array(
        'name' => t('Team URL'),
        'description' => t('Returns a custom url for team and team pages'),
    );
    return $info;
}
function mytoken_tokens($type, $tokens, array $data = array(), array $options = array()) {
    $replacements = array();
    if ($type == 'node' && !empty($data['node'])) {
        $node = $data['node'];
        $path = 'node/'.$node->nid;
        $mlid = db_select('menu_links' , 'ml')
        ->condition('ml.link_path' , $path)
        ->fields('ml' , array('mlid'))
        ->execute()
        ->fetchField();
        $menuParents = token_menu_link_load_all_parents($mlid);
        foreach ($menuParents as $itemParent_mlid => $original) {
                $item = menu_link_load($itemParent_mlid);
                $item_path = $item['link_path'];
                $item_path_args = explode('/', $item_path);
                $item_id = $item_path_args[1];
                $item_entity = entity_load('node', array($item_id));
                $item_type = $item_entity[$item_id]->type;
                $item_title = pathauto_cleanstring($item_entity[$item_id]->title);
                if ($item_type == 'type1' or $item_type =='type2') {
                    $replacements[$tokens['team_url'] = $item_title;
                    break;
                }
        }

}
return $replacements;

}

With this code I get only one parent. The foreach seems not functionnal.

if I use $replacements[$original] = $item_title I get no parent.

Can you help me ?

Thanks.

P.S. If i use a similar code in my node template I get all parent items. It's ok in my node.


texts: Drupal multi site 404s, sub directory site subpages going to default site

texts:
We have a strange set of errors going on with a dev (and stage) version of our drupal multisite.
We have some sub directory sites, and some sites server up on different urls. One URL is an internal one to the Host. The other is an external one (that goes through a firewall).

The essence of the problem is this

the sub directory site homepage displays fine, but any sub pages you click through to come up as 404s -- the 404 that is thrown is on the default site. This happens with sub directory sites on both URLs (external and internal).
I am unable to access site pages using index.php?q=
Some pages that get served up properly, are still showing up as a 404. This doesn't seem consistent on all sites, but it seems weird to begin with.

What I know

The .htaccess is being used by the sites
ModRewrite is on.
At our request, the ISP put some restrictions on one of the URLs.
The same structure works fine on our production site (minus the restricted URL)
sites.php is working fine, so far as I can tell.

What are the things that we could still have configured wrong (our hosting company is equally perplexed)? The problem seems to coincide with locking down the internal URL (to be only visible to VPN).

For now, I can share this URL: http://contentdev.sierraclub.org/coal
Click on a sub link.
Compare to http://content.sierraclub.org/coal

Any ideas would be very much appreciated.


texts:
I would like to create a content type in Drupal 7, which is available in both Italian and English. This is why I enabled multilingual support in the options of publications that allows me to choose the creation of each new node language.
But...How do I then change the choice of language in which I see the node in the web pages?


texts: In content type show same field twice with different widget

texts:
I want to show one field (file type) twice in the same content type (without display suite as it breaks my other modules). After a user uploads a pdf and saves this content. I want one link to lead to pdf file for download(which it does) and the other link to show generic file (open a pdf in browser) and i dont know how to do that part (To change widget type). I have searched Drupal Answers and found some clues on how to do this in template.php

function bsthemel_preprocess_field(&$vars) {
 $node = $vars['node'];
     if($vars['element']['#field_name'] == 'field_document_pdf') {

        //code to copy and render this field with different widget (havent figured out how yet)
}

Now i am still new to drupal and can't seem to figure this out. Also what i have found is function hook_field_widget_form_alter but i think this has to be done after the new field is made. Or i might look at this completely wrong. Any help is appriciated


texts: How to prevent anonymous users not viewing any webform content

texts:
I have created a web form contact us page. Anonymous users can see the contact us page at xxx.com/node/add/webform. After they submit the webform, they can see the content of the form at xxx.com/node/x.

In People > Permission page, I have given two permissions to anonymous users:

webform: create new content
View published content

If I uncheck number 2, anonymous users can not view anything. I also went to structure > content types > webform and I did not see anything there to set the permission.I also searched google and I could not find the specific answer.

Do you know how I can prevent anonymous users not viewing the web form published content except adding the webform content?


texts: Testing site with login access AND login inside

texts:
I know it is counterintuitive, but I need to make my testing site secure and within it I need to test the user login module, so apparently I would be needing two login modules.

Is there a module that allows me to have two separate login systems? The "outer" one could be different from the "inner" one, of course. The "outer" one would only be for accessing a subdomain. The "inner" one would deal with user names and passwords.

Any idea and suggestions are welcome.

Thanx in advance.


texts: Product variations getting same name as product

texts:
I did google this and found the following:

https://drupal.org/node/2146759

however, I cannot seem to find the fields they are indicating. Maybe I have the wrong version of commerce?


texts: Moving from Drupal 6 to 7 - trailing slashes and content views

texts:
I have a site which I need to move from Drupal 6 to Drupal 7.

I heard that Drupal 7 doesn't support trailing slashes (URLs like http://example.com/folder/)

I also heard that to move the content I'll have to manually remap some CCK fields of the posts in the previous version to the fields in the new one. Is it true?

Finally – is there a reliable automated way to move all the content or if I can afford it I should try to move all the pages manually?

Thank you and let me know!


texts: Avoid username output as a class of an article tag

texts:
Drupal 7 generates a username class for the article tag, something like : class="node node-page node-published node-not-promoted node-not-sticky author-username odd clearfix".
I'd like to avoid to have the username output in the code for security reason.
I have tried the userone module, but it doesn't work for this.
I am thinking about some Jquery code, but a better way would be to avoid the username to be output at all.
I was looking in the core modules but I didn't find the php file that generates this author-[username] class.
Any help?


texts:
We want to be able to print a packing slip from a completed order.

I see that the line items is a view but how can I create a new page or tab on the order page to display a clean packing slip?


texts:
I need to provide a view which gives a simple list of user activity with regards to node 'events' - e.g. any updates to fields, new nodes created, nodes deleted etc..

For example,

Last Updated:         Activity
-----------           --------
..
5 mins ago -          username has updated Title for node:nid
6 mins ago -          username has updated Price for node:nid
7 mins ago -          node:nid has been deleted
13 mins ago -         new node:nid has been created..
..etc

Has anyone achieved something similar? If so - how did you go about this? Did you use a module?


texts: Entity print get variable in twig template

texts:
I'm using entity print and I would like to get node variables in my twig template, so I can call them like {{ content.field_name }}.

I tried using a preprocess function but I'm not sure I'm doing things well.

Assuming I have a twig template called entity-print.html.twig, here the preprocess functions I tried :

function THEMENAME_template_preprocess_entity_print(&$vars) {
    $vars['field_name'] = $entity->get('field_name')->getValue();
  }

I also tried

  function THEMENAME_template_preprocess_entity_print(&$vars) {
    $vars['field_name'] = $entity->get('field_name')->value;
  }

I'm calling field_name with all of this twig variable for debugging purpose :

   1 {{ content.field_name.0 }}
   2 {{ content.field_name.value }}
   3 {{ content.field_name.0.value }}
   4 {{ field_name.content }}
   5 {{ content.field_name[0] }}
   6 {{ node.field_name.value }}

Nothing come. What am I doing wrong ? Do I have to make a custom module ?


texts: Create View with 2 rows of diferent Content

texts:
Can someone help me on whow can i create a View Like This?
I Found this view a a theme template at http://demo.megadrupal.com/?theme=md-thenews .

This view is composed by 2 rows. The first one has an image, a title and a teaser and the other rows has a list of articles.
I've also tried the views_field_view plugin, but the output is not the same.
Thanks for you help.

Code behind the view in the image:

        .... //Views Fields

    .... //Views Fields

</div


texts: How to Override OG Group Owner Permissions for view/edit group content?

texts:
So I have a group content type called student portfolio, which is managed by the student. Then I have a group content node type called endorsement that can be written by professors that are group members.

Question 1: How do I prevent students from editing endorsements? There is no checkbox anywhere in my configuration that says the student role can edit endorsement. Also, on my group permissions, for Members, only "Edit own Endorsement content" is checked, but the student can still edit, which seems like a bug if you ask me.

I'm thinking I'll need some sort of hook_menu_local_tasks_alter() code, but just wanted to verify.

Question 2: How do I prevent the student from even viewing a group content page type? (This is a different project.) On the group page, I think this is just a simple matter of setting the permission on the pane, but I also don't want students to be able to view the stand-alone page.


texts: POST taxonomy item using Services module

texts:
I want to POST a new taxonomy item. I'm using Postman in Chrome to test, I'm logged in fine, and I'm posting RAW JSON:

{
  "name": "building",
  "description": "",
  "vocabulary" : {
    "id" : 1,
    "resource" : "taxonomy_vocabulary",
    "uri" : "http://site/cms/taxonomy_vocabulary/1"
  }
}

And I just get this:

<?xml version="1.0" encoding="utf-8"?>
<result>Access denied for user anonymous</result>


texts:
Is it possible to have the administration pages on a different place than /admin?

so something like: www.mysite.com/someotheradminlocation

I don't want the admin location to be guessable by hackers.


texts: add watermark to all images uploaded in the site

texts: I am trying add watermark to all the images uploaded by users. Is there any preprocessor for the same? or any module to achieve it ?


texts:
I am trying to get Privatemsg and DrupalGap working together.

I have installed both modules, configured the privileges and everything is working fine in the drupal site.

But with phonegap I am getting trouble displaying the 'Send this user a private message' link in the view of each user. I have set 'visible' the 'private msg' field in the drupalgap display in: admin/config/people/accounts/display/drupalgap but it's not working.

I have noticed It's always displaying only the history field even if I set to 'hidden' all the fields in the view configuration page: admin/config/people/accounts/display/drupalgap

I have cleared all caches.

What am I missing? How can I have the 'Send this user a private message' link displayed?


texts: How to customize a single default taxonomy page?

texts: In Drupal, we have default taxonomy pages. These pages have the same view. We want to change the layout of one of those pages. Is it possible?


texts: Youtube API module: Post videos to Youtube

texts:
I need to upload videos of my site to Youtube. From Load video to youtube when node save a few modules are introduced that do this.

But I need to do this using an API. I mean I don't want to use the modules interface, I need to have a special interface which is a simple checkbox in the node page of a video to post the video, once a user checks the checkbox.

The Youtube API module seems to be the appropriate module to do this, But I really have no idea of how to use this module. Using the APIs I can use a simple .php  file, by calling it via AJAX, then post the video.

How can I do this? Is there any tutorial for Youtube API module?


texts: Delete/ Deactivate account in a separate block

texts:
I want the authenticated users on my site to be able to delete their own account or temporarily block/de-active. I give the necessary permissions for this. Well and good for now. However, the tricky part is that i want these as separate forms in a page different that user edit. Something like shown in the image below: So that when the user navigates to this page say node/100 then the above is displayed. Any suggestions how to achieve this.

Regards


texts: How to use entity_metadata_wrapper in hook_boot

texts:
I am trying to create an entity with entity_metadata_wrapper from within hook_boot.  I know everyone will say "use hook_init" but for performance reasons, I'm going w/ hook_boot :) .

I have a couple modules loaded like so:

require_once DRUPAL_ROOT . '/includes/common.inc';
drupal_load('module', 'entity');
drupal_load('module', 'field');

This is what I have:

$entity = entity_create('myentity', array('type' => 'click'));
$ew = entity_metadata_wrapper('myentity',$entity);
$ew->field_myentity_url_reference->set($row->rid);
$ew->save();

The above works fine if run normally (like from form_alter or something), but not from hook_boot.

I am getting the following errors:

Warning: class_implements(): object or string expected in entity_create() (line 367 of /data/disk/host/distro/005/drupal-7.18.1-dev/sites/mysite.com/modules/entity/entity.module).
Warning: in_array() expects parameter 2 to be array, boolean given in entity_create() (line 367 of /data/disk/host/distro/005/drupal-7.18.1-dev/sites/mysite.com/modules/entity/entity.module).
EntityMetadataWrapperException: Invalid data value given. Be sure it matches the required data type and format. in EntityMetadataWrapper->set() (line 122 of /data/disk/host/distro/005/drupal-7.18.1-dev/sites/mysite.com/modules/entity/includes/entity.wrapper.inc).

Anyone know what else I need to drupal_load to get this to work?

EDIT - Figure out how to do this:

I used the background process module: http://drupal.org/project/background_process.  I added the code below to hook_boot:

//load the required modules needed to do background_process
require_once DRUPAL_ROOT . '/includes/common.inc';
require_once DRUPAL_ROOT . '/includes/path.inc';
drupal_load('module', 'background_process');
drupal_load('module', 'progress');

background_process_start('shurly_create_click_log', $row);//  drupal_load('module', 'entity');

Then I put the entity code in a new function:

function shurly_create_click_log ($row){
    $entity = entity_create('linkpin', array('type' => 'click'));
    $ew = entity_metadata_wrapper('linkpin',$entity);
    $ew->field_linkpin_url_reference->set($row->rid);
    $ew->save();
}

Basically, the shurly_create_click_log function gets ran at full bootstrap in the background, so it doesn't slow down my pageload/redirect from hook_boot.


texts: How to do a date range entityQuery with a Date only field in Drupal 8?

texts:
In Drupal 8, the Date only field stores data in a varchar column in a CCYY-MM-DD format, e.g., 2016-04-18.

As such, you can't simply do a greater than (>=), less than (<=) or similar timestamp based entityQuery anymore.

Is there a simple solution on how to deal with this? Specifically I am attempting to do two queries, one where the date field is between 14 and 21 days old, and one where the date field is 21 and over days old.


texts: I cannot make the paragraph preprocess work at all

texts:
I have a Barrio-based subtheme and I am rewriting from scratch an old Drupal 7 site to be moved to Drupal 9 (my first Drupal 9 site). All pages in the new site is built by different paragraphs and mostly there aren't problems so far.
A few paragraphs need to fetch content from an external API service (that I myself have written). I tried to add this function both in zzz.theme and theme-settings.php and it seems it's not even called. (zzz is the theme name.)
function zzz_preprocess_paragraph(&$variables) {
  die("Finally got here!");
}

Heck, I have even made some syntax errors on purpose but it still stubbornly gives the page without errors nor changes in the variables.
I don't even know where or what to look for, php-fpm www error log is empty. Am I missing the finger in my eye, or is it something more subtle (like deprecation)?
Drupal 9 documentation is quite sparse so far, though it should be the same as with Drupal 8.


texts:
I need the functionality to be able to have a vote widget on a profile page.  So users can be voted for and the user with the most votes wins.

(the users profile page is done with panels & views)

Ive played around with the flag module and it somewhat works for what I want, also the vote module, but it seems to only work on nodes and comments and doesnt work on user pages...

Any advice is greatly appreciated


texts: How to escape a string so it does not get replaced by Token::replace()

texts:
I have a string that is being sent into the replace method of the token service that looks like a token, but it is not.

Here is an example of the string: "['key:value']"

Is it possible to escape this in a way that the replace function will not think it is a token that it needs to replace?

The "clear" flag in the replace function is set to true, so this string always just gets removed, but I want it to ignore this string entirely. Thanks!


texts: Performance or other implications of sharing fields in Drupal 8?

texts:
There already exists quite a popular question asking about the implications of sharing fields between node/entity types:

What's a good balance between reusing fields versus creating new ones in the context of fields scalability?

However this only really addresses Drupal 7 and not Drupal 8.

Are there any significant differences in Drupal 8? Are there noticeable performance differences to sharing a lot of fields between node types as opposed to create a new field for each node type?

I know the question should be well defined, but it would also be interesting to know if there are any other considerations to take into account when deciding whether to share/not share fields in Drupal 8.


texts:
I was wondering if there was a way to change the url position of a view contextual filters. normally, they are at the end of the URL after the view-name but i would like to have them after the language.

ie: example.com/fr/filter1/filter2/view-name


texts:
l('Visit Website &raquo;', 'http://' . $site->purl_prefix . '.' . $base)

I have a link I want to print like this the » is not getting parse properly it is still showing up as the character code in the link.