texts:
When I am logged as an administrator and try to access Content from the administrator menu, the corresponding window pops up, with the add content link, but just below, I get the following error message:

The requested page "/mywebsite/?q=admin%2Fcontent%2Fnode&render=overlay" could not be found.

although content already exists. What is causing this and how can I get rid of it? I am on Drupal 7 release 12. Thanks.

Update

If anyone has ideas, tips, suggestions about what is causing (or could cause) this issue, it is welcome. Could I have modified the config by accident (if yes, which)? Is there a tool (other than FireBug) to debug this issue? I plan to re-install a system from scratch and check whether the error happens too. Thanks.

Update II

Here is what I get when requesting Content from the Administrator menu:

When I click on Amdinistration, I get the following:

First, I notice something strange: an empty entry in the provided list. Why? I don't know.

Second, when I click on Content from this page, I am not facing the issue I reported above. I noticed a difference in the URLs between both methods:

http://www.mysite.com/#overlay=%3Fq%3Dadmin%252Fcontent%252Fnode <- NOT OK
http://www.mysite.com/#overlay=%3Fq%3Dadmin%252Fcontent <- OK


texts:
I am using entity reference field in a content type with select list widget allows you to add the title of a node in the content type, however the title dose not work as a link to the node.
I would like to now how can i make the title work as a link to the node?

dose Entity Reference link module fits this purpose??
if yes how it works?
if no is there any way to do this??


texts:
Here is my code:

services file

  services:
  my_module.event_subscriber:
    class: Drupal\my_module\EventSubscriber\My_moduleSubscriber
    arguments:
      - '@authentication'
      - '@current_user'
    tags:
      - {name: event_subscriber}

My_moduleSubscriber.php

 <?php

  public function xyz) {
  // I want to attach js here
  $attachement['#attachement'][js] = .....
//    drupal_add_js(libraries_get_path('audio-player').'/audio-player.js');

  }

  static function getSubscribedEvents() {
    $events[KernelEvents::RESPONSE][] = array('xyz');
    return $events;
  }

Since there is no argument passed like $attachement, $page, in which variable should i attach js file in Drupal?


texts: How to add a new user badge after earning a certain number of user points?

texts:
I'm using the User Badges and User Points modules. I want that when a user earns a certain number of user points, the user's old badge is replaced by a new one. For this, I have already created a rule with the actions "remove badge" and "add badge". The condition is "execute PHP code" and the code is:

$current_points = userpoints_get_current_points($userpoints_transaction->uid, 'all');
if ($current_points >=7) {
  return true;
}

I also want to display the badge with the username at the top like StackExchange.

Note: Using the above code, it is displaying a message each time when user getting more than 7 user points. I want the message only once.


texts:
I'm using the module Publication Date  to store when nodes are published. It uses a simple table of nid and published_at for the timestamp. I need to use EFQ to sort nodes by this date, but I'm unsure if it's able to connect to the table it uses.

->propertyOrderBy('published_at', 'DESC');

obviously doesn't work.

Is there any way I can connect to this table using EFQ, or does it have to be a db_query?


texts: How to replace internal links with a view (similar like the Open Graph feature)?

texts:
I would like to have the feature, that if users on my site post internal links within a text, this links are replaced by a thumbnail, node title etc. For choosing what to show instead of the link I would like to use Views.
What would be the best method to do so?

I think, a simple replacement with hook_node_submit() or
something, is not a good solution: If the user edits his content, I
want him to see only what he added himself.
I could do it within the template, but this is not very elegant, I guess.
What is about hook_url_outbound_alter(), would that be the best way?

Please give me a hint.


texts: How do I remove text format information from the bottom of my text areas

texts: I have a content type which all of my users can create instances of.  The last text area has a section listing the particulars of the text format.  I would like to disable this area so that the test format does not explain itself, and all the user sees is a text area.


texts: Is it possible to use many plugin process for a field?

texts:
I'm working with migrate and I need to use multiple plugins for a single process.

is it possible? How?


texts: How to make exposed filters to hide filed with no value

texts:
I am using exposed filters in Views to give user opportunity to select attribute.
I used field with taxonomy term as exposed filters.

As a result, exposed filter shows all possible variants for this field (all terms), instead which really were used in this material. I mean, that user can select any term from vocabulary even if I did not use this term in this content type material.
How to hide unused terms in exposed filters?


texts:
I am using drupal 7

The following code turns an array into a pagered table.

$rows = $data[data];
$per_page = 30;
// Initialize the pager
$current_page = pager_default_initialize(count($rows), $per_page);
// Split your list into page sized chunks
$chunks = array_chunk($rows, $per_page, TRUE);
// Show the appropriate items from the list
$output = theme('table', array('header' => $header, 'rows' => $chunks[$current_page]));
// Show the pager
$output .= theme('pager', array('quantity',count($rows)));
echo $output;

Is it possible to add filters to the table?

Thanks

Updated 21/04/2016 as Per Neograph734s answer

I have built a module based around the code Neograph734 gave as an example.

My array is built like

Array
(
    [0] => Array
        (
            [EventTime] => 23/04/2016 15:00
            [EventType] => Foo
            [EventName] => Bar
            [EventRating] => 99.12
        )

    [1] => Array
        (
            [EventTime] => 23/04/2016 18:00
            [EventType] => FooFoo
            [EventName] => BarBar
            [EventRating] => 94.84
        )

The only ammendment I have made is in field to seach as below

foreach ($rows as $key => $row) {
  if (preg_match("/" . $form_state['storage']['title'] . "/", $row['EventName'])) {
    $temp_rows[$key] = $row;
  }
}

The table initially loads, I have a text area and a submit button. When I enter a search term the page reloads but the table does not filter, it still shows all results.

The html out put is

23/04/2016 15:00
Foo
Bar
99.12

What more do I have to change to get the text field to search the results?

Thanks


texts: Drupal rules discount matrix - look up by taxonomy term

texts:
I'm having trouble applying a complex set of discounts to my products through rules.

The discounts are basically a user-category/product-category matrix with a different discount percentage for each cell. User categories and product categories are taxonomy lists. I have added a Field Collection field (with and infinite number of values) to the user category. In this field collection I combine a product category and a discount percentage (as a decimal), and then repeat for all product categories.

So when calculating the product sale price I need to:

Look up the product category (works fine)
Look up the user category and load the discounts list (works fine)
Look up the right discount in the discounts list by product category (having trouble with this)

I've been able to look up the right discount in a custom PHP action like this:

$product_category = $product->field_product_category['und'][0]['tid'];

for($discount_index=0;$discount_index<count($user_discounts);$discount_index++){
    $discount = $user_discounts[$discount_index];
    if($discount->field_discount_product_category['und'][0]['tid'] ==  $product_category){
        return $discount->field_discount_percentage['und'][0]['value'];
    }
}

return 0;

But apparently returning values out of a custom PHP block is not supported.

Next I thought to install the Conditional Rules module.
I could loop through the discounts and check the current loop variable against the product category and apply the discount if it matched. Within the If I can't access my loop variable though.
Can anyone suggest a method that might work? I prefer not to have to write my own module if it can be avoided.


texts: Allow users to edit the list of CCK allowed values for "select list"

texts:
I have a CCK field ("City") that is a select list, and has manually entered cities in the allowed values list. I added these cities (as the administrator of the website) but I would like to hand control over to the client.
However, changing their permissions, and allowing them full access to the CCK content types would be potentially disastrous; I need a way to give authenticated users permission to add values to this select list.

Is this possible?


texts: How to search views with exposed filters

texts:
I have a page view with exposed filters (4 checkboxes with ajax calling) which user can change.

I want to change default search, to searching only results which appears in this view.

How can I do that?


texts: Trying to theme my user login/registration/password reset pages in Drupal 7, going bonkers

texts:
What seems like it should be a very, very simple task -- theming the user login, registration, and password pages in Drupal 7 -- is turning out to be a Kafka-esque nightmare. I can't figure out what I'm doing wrong, and am wondering if I'm slowly regressing into a newt in the process.

So there's a ka-billion how-to posts all over the place about how to do this (all of the posts I've read seem to be derived from this page here), and a ka-trillion success stories, but sadly, I'm not one of them. Here's what I've done, and tell me, please, I beg of you, what idiotic thing I'm doing wrong:

Step 1:

I added the following code to my template.php file, making sure to replace "yourtheme" with the name of my theme:

<?php
function yourtheme_theme() {
  $items = array();

  $items['user_login'] = array(
    'render element' => 'form',
    'path' => drupal_get_path('theme', 'yourtheme') . '/templates',
    'template' => 'user-login',
    'preprocess functions' => array(
       'yourtheme_preprocess_user_login'
    ),
  );
  $items['user_register_form'] = array(
    'render element' => 'form',
    'path' => drupal_get_path('theme', 'yourtheme') . '/templates',
    'template' => 'user-register-form',
    'preprocess functions' => array(
      'yourtheme_preprocess_user_register_form'
    ),
  );
  $items['user_pass'] = array(
    'render element' => 'form',
    'path' => drupal_get_path('theme', 'yourtheme') . '/templates',
    'template' => 'user-pass',
    'preprocess functions' => array(
      'yourtheme_preprocess_user_pass'
    ),
  );
  return $items;
}
?>

Step #2:

Then, below that code in the template.php file, I inserted this code, again, making sure to replace "yourtheme" with the name of my theme:

<?php
function yourtheme_preprocess_user_login(&$vars) {
  $vars['intro_text'] = t('This is my awesome login form');
}

function yourtheme_preprocess_user_register_form(&$vars) {
  $vars['intro_text'] = t('This is my super awesome reg form');
}

function yourtheme_preprocess_user_pass(&$vars) {
  $vars['intro_text'] = t('This is my super awesome request new password form');
}
?>

Step #3:

I created three new template files called user-login.tpl.php, user-register-form.tpl.php, and user-pass.tpl.php

Step #4:

I pasted the following code into each new template file:

<?php print render($intro_text); ?>

  <?php print drupal_render_children($form) ?>

I'm slightly confused by this:

"Save your template.php file to the theme's main directory. Save your .tpl.php files in the same place for the D6 examples, or, in the case of the D7 examples, to the directory you specify in the 'path' element of the $items array."

But that just means that I should save the .tpl.php files in my theme directory, correct? If so, I did this correctly.

Step #5:

Cleared the cache, moved around some elements...and...

Nothing. Is there anything I'm doing wrong? Thanks in advance for your help.


texts: Is it possible to search a view of views?

texts:
I have a View that is a list of users. One of the fields is an Include View field.

This field includes another View which has a contextual filter for the user, and shows the node that was created in a certain month by that user (if it exists).

These nodes have categories and I would like to have a filter on the main view where I can sort out which users have a node in a certain category. But due to the nature of included Views, I can't find a filter that works.

Is there a way to search a view that is an Include View?


texts: ShareThis in header rather than content type?

texts: I am adding Drupal ShareThis to a header mini-panels, but the buttons are not displayed. Firebug tells me that the corresponding code is not there at all. How can I display ShareThis buttons outside of content types?


texts:
I am implementing a couple of translatable variables that are exposed via hook_variable_info().

Can I use placeholders in these variables, and process them to replace with the actual values?

As an example: I have a variable that holds the following informational text that will be shown on a page that has a registration form below.

  Please signup here to gain access to the restricted area for @yourcompany

I have been googling around for this, but cannot seem to find any good leads on how to do this (if at all possible?)


texts: Commerce-Marketplace : Members tab in store's page doesn't show up

texts:
After this clean install :

Drupal 7.28
Commerce 7.x-1.9
Commerce-Marketplace 7.x-1.0-beta2 (same issue with current dev version)
ECK 7.x-2.0-rc3+15-dev

I create a new store but can't see the "Members" tab as seen on the demo site (I also tried the direct URL "commerce_store/store/{ID}/people", no error but I stay on store page).

Here is a screenshot

And the demo site

Do I miss a step to activate the store members management tab/pages ?

Thanks for your help or direction to solve this.


texts: Generate breadcrumb based on a given Path

texts: How can I know the breadcrumb that will be generated in a page without visiting that page? Is this possible?


texts: The update.php doesn't want to run it's complete course

texts: I updated core Drupal (D7.14) and all seems to running perfectly. Only some updates for the database are required. So I run the update.php and I get through the first stages and I can see the pending updates when I am on the Review updates page. But when I continue (press the button). It seems to get stuck. I don't get to next screen, it just keeps on loading. In one browser I get a blank screen but that's it.


texts:
I am using the SagePay Integration Module.  I have created template file for the cart summary / overview (page--cart.tpl).  I have also crated hooks to alter forms on the next two pages mytheme_form_commerce_checkout_form_checkout_alter and mytheme_form_commerce_checkout_form_review_alter and configured template files for them using the mytheme_theme hook.  The templates are commerce-checkout-form-review.tpl.php and commerce-checkout-form-checkout.tpl.php.

Next I created a template file for the payment page, page--checkout--payment.tpl.php.

SagePay is configured to (only) use Sage Pay Server Integration - specifically Display payment form in an iFrame (can be found at /admin/commerce/config/sagepay).

After investigating the $page variable using Deval/kpr I decided to render

$page ['content']['content']['content']['system_main']

Here is a copy of the code in the template file (page--checkout--payment.tpl.php).

<?php if (isset($page['header'])) {?>
  <?php print render($page['header']); ?>
<?php }?>

<?php kpr ($page); ?>

PROCESS PAYMENT

          YOUR BASKET
          BILLING DETAILS
          PAYMENT OPTION
          PROCESS PAYMENT
          CONFIRMATION

<?php print render($page ['content']['content']['content']['system_main']); ?>

<?php if (isset($page['footer'])) {?>
  <?php print render($page['footer']); ?>
<?php } ?>

The problem is this.  The line

<?php print render($page ['content']['content']['content']['system_main']); ?>

renders the iFrame, but once that is done, the rest of the page does not get rendered.  So the last part which needs to render the page[footer] is not executed.

I tried to save a copy of page[footer] at the beginning of the file, and then render this copy, but same result - footer does not get rendered.

I am assuming either the $page variable is lost / corrupted during the iframe render (unlikely), or the code stops executing after the iframe is rendered and we never get to the footer part (probably - but not sure why).

If I remove the line to render the iFrame, then footer prints out just fine.

My question is this - how I can render the SagePay iFrame form (in an iFrame) ensuring all relevant form fields (hidden, links, etc) is rendered correctly, and still render this inside one of my template files.


texts: Programmatically change input filter of term description on taxonomy_form_term

texts:
I couldn't find anywhere on the admin UI where I can change the input filter for term's description field. I have tried using hook_form_alter, but wasn't successful.

function mymod_form_alter(&$form, &$form_state, $form_id) {
  if($form_id === 'taxonomy_form_term') {
    $form['description']['#format'] = 'full_html';
    $form['description']['#title'] = t('test');
  }
}

The title for the input field would change, but not the format, even though dpm result indicates that the correct key/value pair was used. Is it too late in the rendering process to change the format of the field?


texts: how to have conditional Help text for a listbox field

texts:
Remember the create password page of Drupal! While you are entering characters it tells you how strong your password is!

Now I want to have something like this in a list box but a bit different. I want to show an image and a text depend on the item which is selected in the list box! How can I do it? My first try was adding some code in help text of the field, but it doesn't work. What are your suggestions?

I can not use conditional field because I must add 60 conditions and it is illogical. Ao I need a programmatic way. The java script code and how to I make it dependent to two list boxes?
I add a markup field to my content type but I don't know who to find which item is selected in the list box with ajax ind how to show an item depend on it.


texts: Drupal 7 form, query DB and results display

texts:
I'm still somewhat new to Drupal but have a lot of experience programming in PHP. I'm looking for a list of modules in Drupal. I need to do this common list of tasks that are very typical of DB interaction:

Present a form to a user.
Do a query (select or insert) to one or many tables in a database in a custom DB or the one Drupal uses/
Present results in table form.

Please help me out thanks. Could anybody can give a sample examples.


texts: field update on field with no permission

texts:
I have a field (selectbox) that is configured to not be shown (no 'view' permission) on a particular role, nor not to be edited (no 'edit' permission) by the same role. This role is only able to edit other fields. So normally, when this role edits the content, he should not see this particular field. But I want this field to automatically get updated via 'Triggered Rules'. I don't want anyone able to see this field in the first place. For example:

Price Range Field:

Lowest to 1M
Between 1M to 5M
Between 5M to 10M
Greater than 10M

This is my set up so I could use this in exposed filter views to filter price ranges.

When that role enters some price in 'field_price', a trigger updates the price range field.

I do not have a problem with creating a new content, the price range gets filled out properly. However, when editing this content, I get this error 'Price Range: Illegal value'. When I make this field permissible for this role, this field gets updated properly.

I'm quite sure there is a way to this without doing any complicated stuffs.

Thanks in advance!


texts:
I have:

services:
  entity.query.external:
    class: Drupal\m_entities\Entity\Query\External\QueryFactory
    arguments: ['@plugin.manager.my_entity_storage_client', '@my_entity.storage_client.response_decoder_factory', '@http_client', '@entity.manager']
    tags:
      - { name: backend_overridable }
  my_entity.storage_client.response_decoder_factory:
    class: Drupal\m_entities\ResponseDecoderFactory
    tags:
      - { name: service_collector, tag: my_entity_response_decoder, call: addDecoder }
  plugin.manager.my_entity_storage_client:
    class: Drupal\m_entities\MyEntityStorageClientManager
    parent: default_plugin_manager
  entity.my_entities.routes:
    class: Drupal\m_entities\Routing\MyEntityRoutes
    arguments: ['@entity.manager']
  access_check.my_entities.add:
    class: Drupal\m_entities\Access\MyEntityAddAccessCheck
    arguments: ['@entity.manager']
    tags:
      - { name: access_check, applies_to: _my_entity_add_access }

but my service provider is not loaded in below code:

ModifyServiceDefinitionsPass

$providers = $kernel->getServiceProviders('app'); // <-- not loaded in here
foreach ($providers as $provider) {
  if ($provider instanceof ServiceModifierInterface) {
    $provider->alter($container);
  }
}

how to make a service provider loaded?


texts: What does "Prefetch views unpack data" in APDQC module do?

texts:
There is an option in the APDQC (Asynchronous Prefetch Database Query Cache)  https://www.drupal.org/project/apdqc module for:

Prefetch views unpack data

It's unclear what this does. Should this be turned on or left off as default?


texts: I need to add rel="nofollow" to the button provided by "views load more" module

texts:
I need to add rel="nofollow" to the button "Load More" provided by Views Load More, but the problem is that the anchor is created in views_load_more.module (line 91) this way:

$li_next = theme('pager_next',
    array(
      'text' => (isset($tags[3]) ? $tags[3] : t($vars['more_button_text'])),
      'element' => $element,
      'interval' => 1,
      'parameters' => $parameters,
    )
  );

But I dont know how to add an attribute to that, when I print_r($li_next), it prints the link.

I have tried this:

function THEMENAME_preprocess_pager_next(&$vars) {
  $vars['#path']['options'] = array('attributes'=>array('rel'=>'nofollow'));
}

But didn't work


texts: How to translate content of the composite element settings?

texts:
I have created a composite element where I added a custom textarea field in the element settings.
I have added that element in a webform, filled that textarea and saved the webform.
Now I want to translate the webform, But when I go the webform translations, I am unable to translate the value of that text area.
Is there any way to translate the value of that text area?
/**
 * Provides a booking element.
 *
 * @WebformElement(
 *   id = "my_element",
 *   label = @Translation("My element"),
 *   category = @Translation("Composite elements"),
 *   multiline = TRUE,
 *   composite = TRUE,
 *   states_wrapper = TRUE,
 * )
 */
class Myelement extends WebformCompositeBase {
  public function form(array $form, FormStateInterface $form_state): array {
    $form = parent::form($form, $form_state);

    $form['element']['booking_email'] = [
      '#type' => 'textarea',
      '#title' => $this->t('some content'),
      '#weight' => '0',
    ];

    return $form;
  }
}

Here is the backend of the element settings.

And here is the webform translation interface. I can't see my textarea field so that I can translate its content. I only see the composite element key and title.


texts: How to update the URL Redirect module v1.4 to its latest version without losing redirects?

texts:
When I last went to update the URL redirect module from 8.x-1.4 to its latest version I saw this note:

  After 8.x-1.4 version URL Redirect changed as config entity. If you are using before 8.x-1.4 version, it's strongly recommended to not upgrade module as it deletes all existing redirects in your system.

Since I didn't want to lose all my redirects, I just left the module as it was.  Unfortunately, as of yesterday, v8.x-1.4 is no longer supported.

What is the best fix for updating this module?
Is it just a matter of updating to v8.x-2.3 and redoing the redirects (fortunately I do not have a lot of redirects) or is there an easier way of doing it?


texts: How to set transactional email api key for external app in drupal like mandrill

texts: Like mandril,I have app for routing system transactional mails through that.I got create account in that app and getting api key for my drupal site,But i dont know how to process it (where to add that api key to configure it)on drupal to send mail.please clarify.


texts:
I'm having an odd problem with the CDN module... If I upload an image, the URL for each image style will appear broken until I open it in the browser first. Then, it will work in the CDN. I've tried with a couple of different CDNs (at first I was thinking the one I was using wasn't passing the ?itok parameter along), but I still get the same results.
It seems as though the image style isn't being created when the CDN tries to access the URL, but I'm not sure why.
I'm using Drupal 8.8.5.


texts: Private files need to be switchable to public

texts:
We have private nodes. Nodes that are just visible for logged in users. These nodes are setup to use a private filesystem. These "private" nodes can also become public if an article is moved to the front page for example - or when an editor decides, that the content is not just for members any longer.
I assume all images uploaded before via the private file system setup now will not work any longer.
I guess I could check every single file via hook (if there is one) and check the access settings for the parent entity (node). But I am pretty sure I am not the first person, that needs to switch content from private to public. There must be a more solid way.
I could not find any information regarding this in the documentation.
Whats Drupals way to deal with dynamic (public / private) states and its media?
Thanks


texts: How to process the data which type is BLOB?

texts:
I get the following data from MySQL by db_query(). The type of the column is BLOB.

  a:2:{s:10:"attributes";a:1:{s:5:"title";s:0:"";}s:8:"langcode";s:7:"zh-hans";}

How should I process it?


texts: How do I use $form_state to return data from the from submission handler to the form builder?

texts:
I am trying to populate a data based on $form_state right after submission.
What I am trying to do is to populate a form that takes a keyword and passes it to a function that gets the result from another site.

I can use $form_state['values']['keyword'] in MYMODULE_form_submit() but not in MYMODULE_form_page().

How can I achieve this?

function MYMODULE_menu() {
  // Module settings.
  $items['MYMODULE'] = array(
    'title' => 'MYMODULE',
    'description' => 'MYMODULE',
    'page callback' => 'MYMODULE_form_page',
    'page arguments' => array('MYMODULE_form'),
    'access callback' => TRUE,
  );
  return $items;
}

function MYMODULE_form($form, &$form_submit){
  $form['kname'] = array(
    '#title' => t('What would you like to search:'),
    '#type' => 'textfield',
    '#required' => TRUE,
    '#description' => t('Please insert the keyword you whish to search for.'),
  );

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

  return $form;
}

function MYMODULE_form_submit($form, &$form_state) {
  $keyword = $form_state['values']['kname'];
  $op = MYMODULE_simple_page($keyword);

  return $op;
}

function MYMODULE_form_page($op) {
  $build = array(
    'header_text' => array(
      '#type' => 'markup',
      '#markup' => '

',
    ),
    'example_form2' => drupal_get_form('MYMODULE_form'),
    array(
      '#type' => 'markup',
      '#markup' => '
'. $op .'
',
    ),
  );

  return $build;
}

function MYMODULE_simple_page($keyword) {
  // Query the external website.
  $data = drupal_http_request('API_ADRESS_JSON');

  // Decode JSON.
  $test = drupal_json_decode($data->data);
  $outitem = '';
  $output = '';
  // Loop through the array (converted from JSON) and view the list of the result as titles and images.
  if (isset($test)) {
    for ($i=0; $i<count($test['images']); $i++) {
      $imageName = $test['images'][$i]['title'];
      $variables = array(
        'path' => $test['images'][$i]['thumbnail_path'],
        'alt' => 'Test alt',
        'title' => 'Test title',
        'attributes' => array('class' => 'some-img', 'id' => 'my-img'),
      );
      $img = theme('image', $variables);
      $outitem .= '

'. $imageName .'

'. $img .'

';
    }
  }

  $output .= $outitem;

  return $output;
}


texts:
I have created a role, Admin. Admin has permissions: "Assign roles" (via RoleAssign), "Access administration pages", "View admin theme", and "Administer users".

I export the role with Features (including the permissions one by one, as well as the role itself).

I delete the role in config and clear cache before enabling the feature. I enable the feature. I drush fr adminrole and I get Current state already matches defaults, aborting.

But my new Admin role doesn't have the expected permissions. Sometimes it has "Access administration pages" and "view admin theme" but it does not have "assign roles" or "administer users".

Is this a case where Features requires Strongarm? Or do I have to use Secure Permissions (which would be less than ideal because other administrators would not be able to change permissions in config anymore.)


texts: Breadcrumb trail not displaying correctly in custom module

texts:
I'm working on developing a custom module for Drupal 7.  Part of the module that I'm creating is a form editing component (with an entirely different aim from something like cck, which is why I am re-inventing the wheel here). I've got one page registered to display a list of all the forms, and another registered for viewing and editing a specific form.  I would like the breadcrumb on the viewing page to include a link to the listing page, however it does not appear.  I am getting "Home » Administration » Jarrow ETD System", while I would like to have a "Form Editor" component on the end.  The relevant hook_menu code looks like this:

$items['admin/settings/jarrow'] = array(
  'title' => t('Jarrow ETD System'),
  'description' => t('Configure the core settings for the Jarrow ETD system'),
  'page callback' => 'drupal_get_form',
  'page arguments' => array('jarrow_configure'),
  'access arguments' => array('administer etd'),
  'type' => MENU_NORMAL_ITEM,
);

$items['admin/settings/jarrow/forms'] = array(
  'title' => t('Form Editor'),
  'description' => t('View All Forms'),
  'page callback' => 'jarrow_list_forms',
  'file' => 'form_editor.inc',
  'access callback' => 'user_access',
  'access arguments' => array('administer etd'),
  'type' => MENU_LOCAL_TASK,
  'weight' => 40,
);

$items['admin/settings/jarrow/forms/%/view'] = array(
  'title' => t('Form View'),
  'description' => t('View a Form'),
  'page callback' => 'jarrow_view_form',
  'page arguments' => array(4),
  'file' => 'form_editor.inc',
  'access callback' => 'user_access',
  'access arguments' => array('administer etd'),
  'type' => MENU_NORMAL_ITEM,
);

There are a significant number of other pages registered, which I have omitted.  Aside from the fact that I probably shouldn't be using 'admin/settings' as my base url, I can't see anything wrong with the menu structure.  Oddly enough, if I add in the following code to hook_menu, I get the right result:

$items['admin/settings/jarrow/stuff'] = array(
  'title' => t('Stuff Editor'),
  'description' => t('View All Forms'),
  'page callback' => 'jarrow_list_forms',
  'file' => 'form_editor.inc',
  'access callback' => 'user_access',
  'access arguments' => array('administer etd'),
  'type' => MENU_LOCAL_TASK,
  'weight' => 40,
);

  $items['admin/settings/jarrow/stuff/%/view'] = array(
  'title' => t('Stuff View'),
  'description' => t('View a Form'),
  'page callback' => 'jarrow_view_form',
  'page arguments' => array(4),
  'file' => 'form_editor.inc',
  'access callback' => 'user_access',
  'access arguments' => array('administer etd'),
  'type' => MENU_NORMAL_ITEM,
);

This is exactly the same entry into hook_menu, down to the function it's calling, except for the url having "stuff" in it instead of "forms".  However, the breadcrumb trail displays properly: "Home » Administration » Jarrow ETD System » Stuff Editor".

I took a look at the inner workings of menu.inc, and traced the execution.  It appears that when Drupal assembles the menu tree for the form, it is including the child /view, whereas for "stuff" it does not.  I can't for the life of me figure out why, and I am hoping someone with experience dealing with drupal's menu system can provide some explanation as to why the menu would be constructed as such.


texts:
After issuing the following command in the base drupal folder (/var/www/html)

$ drush status

I get the following response.

PHP Fatal error:  Cannot redeclare libraries_drush_command() (previously declared in /var/www/html/profiles/commons/modules/contrib/libraries/libraries.drush.inc:13) in /var/www/html/sites/all/modules/libraries/libraries.drush.inc on line 25
Drush command terminated abnormally due to an unrecoverable error.                                                                 [error]
Error: Cannot redeclare libraries_drush_command() (previously declared in
/var/www/html/profiles/commons/modules/contrib/libraries/libraries.drush.inc:13) in
/var/www/html/sites/all/modules/libraries/libraries.drush.inc, line 25

This is a new server install using RHEL 6.4 (Santiago) and drush 6.0 installed through pear.

Where I might begin to fix this?


texts: Single site vs Sub-sites vs Multi-site installation + Scalability

texts:
I am beginning a new Drupal project that needs to very scalable and I need to determine what the structure should look like based on the current and eventual project needs.  I have previously used all separate Drupal sites to accomplish similar goals, but would like to at least consider something a little less maintenance-intensive if it makes sense.  Any ideas or advice on how to proceed is much appreciated... thanks.

Players:
-Organization A (main organization)
-Organization B
-Organization C
-Organization D
(and there may be more in the future)

Functions:
-Main public "front area" of site where all organizations land: orga.site.com
-Access-restricted area for members of Organization A: orga.site.com
-Access-restricted area for members of Organization B: orga.site.com/orgb
-Access-restricted area for members of Organization C: orga.site.com/orbc
-Access-restricted area for members of Organization D: orga.site.com/orgd

Access-restricted areas have similar functions between organizations but not exactly the same, and look and feel (theming) would be different for each organization in the restricted areas.

Additionally, each organization's restricted access area would have sub-areas that are further restricted to a smaller group of people, e.g.:

Organization B:
-Main front: orga.site.com
-Restricted area accessible to all members of Org B: orga.site.com/orgb
-Area restricted to a sub-group in Org B: orga.site.com/orgb/groupa
-Area restricted to a different sub-group in Org B: orga.site.com/orgb/groupb

This type of sub-site differentiation would be typical for each different organization.

Normally when I map a project out like this I have a good handle on how to proceed; in this case my head is still spinning a bit, so any input is helpful.


texts: Reverse geocoding (country) from geofield with coordinates

texts:
is there a quick way to do a reverse geocoding from a geofield field containing geographical coordinates?

I just need the country name, so I wonder if there is some service with more allowance than the Google API, or even a hosted solution with country coordinates and a drupal module quering it???? (as it seems to be a Drupal module for everything)


texts: How to print taxonomy term field in node.html.twig?

texts:
In Drupal 7 we use following snippet to print taxonomy term field in node.tpl.php

$term = taxonomy_term_load($node->field_example['und'][0]['tid']);

$result = field_view_field('taxonomy_term',$term,'field_desired_field');

echo render($result);

In Drupal 8 how we can print taxonomy term field in node.html.twig?


texts: Set and Get $form_state with ajax button submit function?

texts:
In my case, I need to get a list of config files to show in a form element. Extending from this Drupal Answers Q/A using form_state->set() inside ajax callback but cannot get the value back outside the callback, I see a suggested way of calling a static function in the submit.

However, I am missing some understanding of how to properly execute.

$list = '';

$form['fieldset'] = [
  '#type' => 'fieldset',
  '#prefix' => '
',
  '#suffix' => '
',
];

$form['fieldset']['list'] = [
  '#type' => 'item',
  '#title' => t('List'),
  '#description' => $list,
];

$form['fieldset']['submit'] = [
  '#type' => 'submit',
  '#value' => $this->t('Submit'),
  '#submit' => [static::class, 'customFunction'],
  '#ajax' => [
    'callback' => '::customCallback',
    'wrapper' => 'wrapper',
  ],
];

public function customCallback(array &$form, FormStateInterface $form_state) {
  $list = $form_state->get('list');
  $form_state->setRebuild(TRUE);
}

public static function customFunction(array &$form, FormStateInterface $form_state) {
  $form_state->set('list', $li);
}

How does one get $form_state value into a form element from an ajax button submit function?

Update:

Here is what I have working for this case thanks to @No Sssweat.

public function buildForm(array $form, FormStateInterface $form_state) {

  $form['fieldset']['list'] = [
    '#type' => 'item',
    '#title' => t('List'),
    '#description' => '',
  ];

  $form['fieldset']['submit'] = [
    '#type' => 'submit',
    '#value' => $this->t('Submit'),
    '#submit' => [static::class, 'customFunction'],
    '#ajax' => [
      'callback' => '::customCallback',
      'wrapper' => 'wrapper',
    ],
  ];

}

public function customCallback(array &$form, FormStateInterface $form_state) {

  $values = $form_state->getValues();
  $li = [];
  $config_path = drupal_get_path('module', $values['fieldset']['module_name']) . $values['fieldset']['directory_path'];

  if (is_dir($config_path)) {
    if ($dh = opendir($config_path)) {
      while (($fileName = readdir($dh)) !== false) {
        if (pathinfo($fileName, PATHINFO_EXTENSION) == 'yml') {
          $fileName = str_replace('.yml', '', $fileName);
          $li[] = $fileName;
        }
      }
      closedir($dh);
    }
  }

  $markup = new TranslatableMarkup(
    '
@li
', [
      '@li' => t('
' . implode('

', $li) . '
'),
    ]
  );

  $form['fieldset']['list']['#description'] = $markup;
  return $form['fieldset'];
}

public static function customFunction(array &$form, FormStateInterface $form_state) {
  // Empty.
}

But this avoids the question as asked.


texts: How to link a manager with the manager's team and supervisor?

texts:
A user submits a webform, the user's manager can validate it to him/her or not. After validation the manager sends the webform to another department for validation.

I'm using Webform Workflow for changing the status of the webform. Now I don't know what options I have so that when the manager submits his/her own webform, the webform is sent to the manager's director.

I tried the Subuser module but it's not what I'm looking for, it doesn't work for me: I need to link for each manager the manager's team of simple users and the supervisor of the manager.

Any suggestions?


texts: Module is enabled but none of the hooks work

texts:
I have created this simple module (named "youtube"):

echo 'outside function';

function youtube_view($node, $view_mode) {
   echo 'inside function<br />';

    return $node;
  }

I can only see the echo outside of the function. I've tried numerous hooks and I can't get any of them to work. The only thing different is that I am a new user to Drupal 7 and this is created on a multi site.

My structure for this module is:

sites/customsites/modules/youtube

And the site can see it fine as I have enabled it in the backend.

Do you have any idea on why this happens?


texts: Install Commerce 2.x project template windows using composer and got HTTP 500 error

texts:
I want to install Drupal Commerce 2.x in Drupal 8.x in Windows. I followed as in  Commerce 2.x project template in Github. I installed composer and from my cmd window, I ran command: composer create-project drupalcommerce/project-base mystore1 --stability dev --no-interaction

All was going fine. It loaded many components like phpunit 4.8.27. Then it displayed messages like commerceguys/addressing suggests installing sysfony/intl ... and like these. Then Writing lock file ,  Generating autoload file, Downloading file:100%, Downloading file:100%,

Then I got Downloading file:Failed

Composer/Downloader/TransportException
The "http://cgit.drupalcode.org/drupal/plain/.eslintignore?h-8.2.0-rc1: file could not be downloaded (HTTP/1.1 500 Internal Server Error)

I also searched if it had created some folder somerwhere in my C:\xampp\htdocs or somewhere, I could not get anywhere. Please help me install it completely and access drupal from browser.
I have attached screenshot. The errors are seen in lower section:


texts: How to hide My results tab for the User using Quiz module in Drupal 7

texts:
It looks so silly to ask these questions but I'm beginner in drupal. I need a help on implementing the modules. I'm trying to build a portal using Quiz Module wherein I need to hide a tab for the user but should be visible to administrator.

Is it possible to hide the My results tab in drupal 7? If so how?


texts: Drupal role does not appear in Views Filter

texts: According to one post, I added Author uid in contextual filter but user role still does not appear in the filter. Any other lead help?


texts: How do I print a twig variable inside a JavaScript in a twig file

texts:
I have a twig file of a custom module. It has a <script></script> section and I need to print a twig variable inside that section. How do I do this?

{{ set twigVariable = '123456' }}

<script>
    function myFunc() {
        var myJsVar = {{ twigVariable }};
    }
</script>

The variable does not print when I write like above.


texts: Image upload form / image field in a panel pane

texts:
There was an earlier post on this topic, but it got no answers and its outdated.
Is it possible, through any modular functionality, to insert an image into a (mini-)panel, either through token replacement, or through an upload dialog, or through a file selection menu?

I want to build a site with images in a particular layout as a block, and make it very easy for my client to change those images in the future. I can think of some other ways to make this work, but it's driving me crazy that there seems to be no way to simply PUT an image in a mini-panel without having to upload it and hard-code an image tag.

And since my client knows no HTML, coding it this way makes it un-helpful for him. And this mini-panel block is going to be used on a number of pages, and needs to be easily modified.


texts: Hide specific sections on admin configuration page

texts:
I wondering how I may hide some sections on the administration configuration page? I would like to hide some sections entirely for instance the media section and then only remove certain items for others, under the system section I only like to remove the cron item.

I tried to alter the admin/config page using hook_admin_paths_alter() and hook_preprocess_page() but without any luck. Would be nice if some one could point me in the right direction on how to achive this.

function MODULE_admin_paths_alter(&$paths) {
   // hide some paths
   $paths['admin/config/system/cron'] = FALSE;
}

function MODULE_preprocess_page(&$variables) {
  if(path_is_admin(current_path())) {
    // I don't know how to modify the markup of the page
    // tried to add a template called page--admin--config.tpl.php but
    // without any luck
  }
}

In the end I used @Captain Pants solution:

function pe_admin_permission() {
  return array(
    'access extended config' => array(
        'title' => t('Access Extended Configurations'),
        'description' => t('Gives a user access to extended configuration pages.'),
        'restrict access' => TRUE,
    ),
  );
}

function pe_admin_menu_alter(&$items) {
  // add all items you would like to hide here
  // if you hide all items in a specific section the entire block
  // will be removed
  $sections = array(
    'admin/config/system/cron',
    'admin/config/system/actions',
    'admin/config/system/mimemail',
    'admin/config/system/mailsystem',
    'admin/config/date/date_popup',
  );

  // loop through each item you would like to hide
  foreach($sections as $section) {
    $items[$section]['access callback'] = 'user_access';
    $items[$section]['access arguments'] = array('access extended config');
  }
}


texts:
I'm working on some views and I came across a requirement I'm not sure how to handle.

I need the title for each returned item to link to a specific URL. However, if another field (a link field) isn't empty, link to that link instead. I believe I need to edit the view template files but I'm not sure how to get started.

In my view, I've found the "Theme: Information" section and am able to get template files working for my view. However, it's listing display, style, row, and field templates. Where would I incorporate the logic I described above for the title field?
Once in a template file I am unsure of what variables are available to me. Is there a list or a way to discover these?


texts: How to create a view that shows Variations type, Vocab name, terms values?

texts:
Product variation type view

Hello Drupal community,

I'm trying to create a view which shows product variation type, attribute name (drupal vocab name), attributes value (drupal terms name) of that variantion type.

EXAMPLE:

  Variantion type, Attribute name, Attribute value

  Variations type, Vocab name, terms values

  Audio Video , Colour , Black

So far I managed to get Terms name and Vocabulary names but how to relate them to Product Variation type?

Any suggestions how to achieve this?

Any assistance would be appreciated.
Thank you
Darius


texts: Theming own field: how do I control the outer markup?

texts:
I'm working on a custom field and formatter and right now I'm at the theming stage. My formatter should render a list of items as a run-in list of badges, much like the tags here on Drupal answers. Currently I am getting a top-to-bottom list, as the fields get the Drupal's default wrappers:

...

...

I thought it would be more appropriate if I had a control over the wrappers markup and delivered something like:

  Value 1Value 2etc.

I have already managed to control the span markup via a custom tpl, but I'm unsure how I am supposed to theme the field's outer markup to suppress the default wrappers.
Of course I know I could override div styling by setting display: inline-block, but I treat this as my first theming excercise hoping to learn.


texts: How to set field value in custom webform submit handler?

texts:
In a custom submit handler, I want to set a field value for a text field (my_field_machinename) in my webform. The handler is getting called correctly, but the value is not getting stored. What do I have to change in the code below to make it work?
I know I could use the presave hook, but I would prefer to make the alteration within the submit handler.
class CustomHandler extends WebformHandlerBase {

  use StringTranslationTrait;

  /**
   * {@inheritdoc}
   */
  public function submitForm(array &$form, FormStateInterface $form_state, WebformSubmissionInterface $webform_submission) {
    $this->submitMyFieldData($form_state);
  }

  /**
   * Set my field values
   */
  private function submitMyFieldData(FormStateInterface $formState) {
    $formState->setValue('my_field_machinename', [['value' => '123']]); // Does not work

  }

}


texts: Are the data stored with the tempstore.private and tempstore.shared services expected to be removed when the user account is deleted?

texts:
Both the tempstore.private and tempstore.shared services store data which have an associated owner; for logged-in users, that is the user ID.

When an account is deleted, are the data having that user ID as owner removed?

I looked at User::postDelete(), but there isn't code for that.

public static function postDelete(EntityStorageInterface $storage, array $entities) {
  parent::postDelete($storage, $entities);
  $uids = array_keys($entities);
  \Drupal::service('user.data')
    ->delete(NULL, $uids);
}

It could be I didn't look at the correct class, or the code to delete those data is still missing from Drupal core.

Should I expect the data stored with the tempstore.private and tempstore.shared services be immediately deleted after a user account is deleted?


texts: How to build a reusable configurable form

texts:
How could I build a reusable form that can be reconfigured for each location in which it is used? It would have the same fields, however select list values would be different depending on what the user thinks it should contain based on its location in the site.

Locations include blocks and panels across many pages and sites, and potentially
multiple locations on the same page.


texts: How to assign nodes to an organic group in code

texts:
How can I assign a node to an organic group in code?
After consulting following page

http://www.barnettech.com/content/adding-node-organic-group-programmatically
Programmatically assign a node to an organic group

And de OG API I ended up with this code, but it throws an error 'The website encountered an unexpected error. Please try again later.'

$node = node_load(5827);
$values = array('entity type' => 'node', 'entity' => $node, 'field_name' =>'og_group_ref');
og_group('node', 3, $values);
node_save($node);

More info:
OG-7.2.7


texts: Characters Converted to HTML Entities in Submission Email?

texts:
I have a webform in which I've developed a custom module to add a value to a hidden element based on inputs received by the person submitting the form. I also have an email handler specified that sends the submitted values, including the value assigned to the hidden field, to me as the site administrator. I'm using the Swift Mailer to get uploaded files delivered as email attachments. I have the email configured to be sent as plain text.

This all seems to be working fine, with the exception that quote characters (") that my module adds to the value of my hidden field and other characters that were typed into a text field are being converted by something into HTML entities (&quot;). I've checked the value of the fields via debug logging and things look fine when the field values is saved. What might be converting the quote characters, and what can I do to avoid the conversion?

My code:

/**
 * Form submission handler.
 *
 * @WebformHandler(
 *   id = "register_form_handler",
 *   label = @Translation("Vehicle Registration"),
 *   category = @Translation("Form Handler"),
 *   description = @Translation("Reformat vehicle registration values"),
 *   cardinality = \Drupal\webform\Plugin\WebformHandlerInterface::CARDINALITY_SINGLE,
 *   results = \Drupal\webform\Plugin\WebformHandlerInterface::RESULTS_PROCESSED,
 * )
 */
class RegisterWebformHandler extends WebformHandlerBase {

  /**
   * {@inheritdoc}
   */
  public function submitForm(array &$form, FormStateInterface $form_state, WebformSubmissionInterface $webform_submission) {
    // Get an array of the values from the submission.
    $values = $webform_submission->getData();

...

    // Capture owner data in CSV format for database entry.
    $csv_temp = '"' . $values['owner_name'] . '",'
      . $values['email_address'] . ","
      . '"' . $values['telephone_number'] . '",'
      . '"' . $values['street_address'] . '",'
      . '"' . $values['city'] . '",'
      . '"' . $values['zip_postal_code'] . '",'
      . '"' . $values['state_province'] . '",'
      . '"' . $values['country'] . '",,'
      . $values['vehicle_identification_number'];
    $values['owner_entry_csv'] = $csv_temp;

...

    // Set submission data.
    $webform_submission->setData($values);
    return true;
 }
}


texts:
I'm trying to create tab in node display that links to node delete form. I used hook_menu_local_tasks_alter in template.php

function mytheme_menu_local_tasks_alter(&$data, $router_item, $root_path) {
// Add a tab linking to node/add to all pages.
$data ['tabs'][0]['output'][] = array(
'#theme' => 'menu_local_task',
'#link' => array(
    'title' => t('Delete'),
    'tab_parent' => 'node/%',
    'tab_root' => 'node/%',
    'tab_root_href' => 'node/'.arg(1),
    'tab_parent_href' => 'node/'.arg(1),
    'href' => 'node/'.arg(1).'/delete',
    'access callback' => 'node_access',
    'access arguments' => array('delete', 1),
    'localized_options' => array(
    'attributes' => array(
     'title' => t('Delete'),
    ),
  ),
),

);

}

Tab is created but it is displayed for every user and on every page where tabs are enabled. How can I configure access arguments to display tab only on node display page and only for user with permissions [Content type]: delete own content?


texts: I'm working on a form where I have added Company field as entity reference and which is type of auto complete. Is there any way, which can show other attribute of company content type like phone number and email in the form post selecting the company name.


texts:
I created a custom searchpage.tpl.php to print out search form and search results using the following code:

<?php
print drupal_get_form('search_form');
?>

<div class="search-result <?php print $search_zebra; ?>">

    <a href="<?php print $url; ?>"><?php print $title; ?>

    <?php if ($snippet) : ?>

<?php print $snippet; ?>

    <?php endif; ?>

It shows the search form correctly and when I search a phrase, URL changes to http://domain.com/search/node/phrase
But it doesn't show the search results, How can I make it work please?


texts: How do I block access to forum landing page, forum containers and forum posts?

texts:
I need only members to be able to access the forums. I have researched this to death and from what I can tell, I need to have at least three modules to achieve this.

Path access to block access to the core forum landing page at /forum (as it is not a node, entity nor view)
Forum Access module to block the top level forum containers
And Taxonomy Access or something like Node View Permissions to block access to the forum topics posts themselves.

Are you kidding me??? I need three permission modules just to stop anonymous users from looking and using the forums. Am I missing something here?


texts: Is there a specific drupal way to focus on one specific part of a nodes element in the css path? For example if I change the H2 element within my theme css it changes all H2... How can I change one specific one on the page. The object is to be able to focus on particular elements to make them unique... If this is possible how do I write the style declarations?


texts: I want my LinkItem to get target="_blank" if my node has the checkbox checked

texts:
I'm not sure if hook_preprocess_node is the right hook. But I cant find the setting for target in the LinkItem. Can you help me?

A different approach I failed is to extended the FieldWidget of Link and add a checkbox to toggle the target setting. I wasn't able to save this setting though...

class TargetLinkWidget extends LinkWidget {
  public static function defaultSettings() {
    return ['target' => ''] + parent::defaultSettings();
  }

  public function formElement(FieldItemListInterface $items, $delta, array $element, array &$form, FormStateInterface $form_state) {
    $element = parent::formElement($items, $delta, $element, $form, $form_state);

    $element['target'] = [
      '#type' => 'checkbox',
      '#title' => t('Open link in new window'),
      '#value' => '_blank',
      '#default_value' => $this->getSetting('target'),
    ];
    return $element;
  }
}


texts:
I'm using a date field on my custom type, if I use "select" widget for node editing, I can choose only between "YMD","MDY" and "DMY" formats.

Is there a way to add custom formats? I need an "only year" format.


texts:
I am thinking about creating a search engine frontend for a special use case using Drupal 7. There are some modules in the module directory, and questions like Consume SOAP web service in Drupal 7 on SO, but I still am confused.

How is the mapping from external datasets to dynamic Drupal nodes done? For every dataset I retrieve through my service's WSDL interface, I'll need to create a node, a block or anything displayable in Drupal.

Is this even possible within the scope of Drupal's framework?


texts: What does it mean "Rebuilding" in a feature? Can it be resolved?

texts:
I did some changes in my local environment, then I updated the 'feature'.

When I try to deploy the change to another environment, but before I can start the 'revert' operation, some parts of the feature are marked as 'Rebuilding'.

The feature components are:
- Field bases
- Field instances
- Strongarm

Additional details

I cannot use drush in the deployment environment.
This happened once in the past and it resolved itself after clearing the caches.


texts: Logintoboggan- Providing the one-time login link in an admin view

texts:
Logintoboggan can be configured so that users are initially assigned an unverified role and only become authenticated users when they click the link in their e-mail for the first time.

However, sometimes users have trouble clicking the link (low technical ability, old cellphones that don't recognize the link, etc.)  For this reason, sometimes the admin needs to activate a user's account on behalf of that user.

I have a view of users with the unverified role and I would like to add the one-time login links to the view so that admins can simply click them.  Logintoboggan provides a token, [user:one-time-login-url], but this token cannot be used in Views.

Is there some way I can show the link in Views?


texts: How do I add additional view modes for a node?

texts:
I am creating a custom content type. By default, nodes support only two view modes (full and teaser):

function mymodule_view($node, $view_mode)
{
    if ($view_mode == 'full') {
         $node->content['#theme']= 'my_full_node_view_theme';
    }

    if ($view_mode == 'teaser') {
          $node->content['#theme']= 'my_teaser_node_view_theme';
    }
    return $node;
}

I want to add some other view modes for this node type, like:

small_box
small_box_with_user_pic
big_box

and want to render the node with code like this:

$node = node_load($my_nid);
$output = drupal_render(node_view($node, 'big_box'));

Any suggestions?


texts:
Is there a  way to sum a numeric value and display it from a field column data in a table view format using search api? I have a DB server (not solr). I need facets.

I've tried the following methods:

1.- search api node index views has no "aggregation settings" (not possible here).

2.- Views calc module (goes out of memory).

3.- Views Aggregator Plus module, "it works", but always result is equal to zero.

I'm run out of posible sulutions, please help.


texts: Drupal features recreate issue with CCK fields

texts:
I have created a form using CCK with conditional fields. If I use the features module to recreate and export the new settings to my staging machine the form comes out flat.

So for example my form is set up to expand other options based on a selection (second option on a drop down box will show different form fields).

After re-creating and sending the files over to staging, same deployment, version and all that for some reason the CCK form appears flat. All the fields that are supposed to be hidden behind certain field selections now appear flat.

So the files that I might have transferred for example after downloading the feature:

support_tickets_v2.features.conditional_fields.inc
support_tickets_v2.features.content.inc
support_tickets_v2.features.fieldgroup.inc
support_tickets_v2.info
support_tickets_v2.strongarm.inc
support_tickets_v2.views_default.inc


texts: Unable to add new OpenID identity in Drupal 7

texts:
I have been using OpenID authentication in Drupal 7 for quite a while, using an myopenid.com identity.  Now, since myopenid.com has announced that they are going away, I want to add a new OpenID identity to my account.

However, I am not able to add another identity.  When I try to add another identity, the browser starts loading a page, but then stops loading.  I am not taken to the provider's login page, whether or not I am logged in to the provider's site.  (I am already logged in to my Drupal 7 site -- I am adding the new ID from my profile's OpenID Identities tab.)

When I manually go back to that OpenID Identities tab, the myopenid.com identity is there, but the new one is not.

There is nothing in the Apache error log or access log suggesting what is going on.

Any idea how to debug what is going wrong?


texts:
I'm moving a website in a production server and it appears that the image thumbnails aren't created from an Image Field in a content.

The images are uploaded correctly but no files are created in styles folder. I've already set to 0777 each folder in case of a permission problem, but it's not that.

The big problem is that I can't remove the images, probably because it raises a forbidden file as it doesn't exist. The only error log I can find is an access denied but nothing else.

Does anybody has the same problem ?

It works okay on local... maybe an Apache issue to look at ?


texts: How do I change the uploaded file name after the node has been saved?

texts:
How can I change the name of an uploaded file after the node has been saved?
I know there is the FileField Paths module for this purpose, but it's still buggy for Drupal 7. I looked at the source of the module, but I can't extract the necessary code.

The only thing I know is that I  should use hook_node_update() and field_attach_update(), but I don't know how to use them.


texts:
I created a view block to display my content in a boostrap grid.

My question is simple:

How to create a "Header" in my view to create an "Accordion" link and display My content when I click on it?

I want to display on the link "Accordion", the number of elements of the view

I would like to do like this page, but with the contents of my view instead of the text :

https://www.w3schools.com/bootstrap/tryit.asp?filename=trybs_collapsible_accordion&stacked=h


texts: How to display Views fields as a drop down menu?

texts: I have several fields in a View which I would like to appear as a drop down when another field is hovered over. It is possible to create a jump menu and a fieldset in Views, but how does one create a drop down menu? I have tried using the Block Reference module but this doesn't seem to show in Views. The only other option I can think of is writing the HTML in a global Views field and using replacement patterns, but there's got to be a better way. How can this be done?


texts:
How can I lead to 404 Page Not Found when View page has no result?

I tried this code from http://drupal.org/node/1295824#comment-5192868in "empty text" but the View page still exist with only page title eve if it has not result to list.

<?php
drupal_set_header('HTTP/1.1 404 Not Found');
?>


texts: What happens after module upgrade if you modify the default views

texts: I want to modify a view supplied by a module. What happens to the view when I upgrade the module? Does it overwrite my changes? If it doesn't and the views in the upgraded version of the module has changed, how do I get the new version?


texts:
I have a custom field declared and I am trying to make it sortable. The field holds date values already formatted ie: 06/10/12. How could I make this sortable? I thought this code would work but the header on the table doesn't become hyper linked even.

     function uc_order_views_data() {
      $data['uc_orders']['data'] = array(
        'group' => t('Order') . ':data',
        'title' => t('Ship Date'),
        'help' => t('The date to ship the order.'),
        'field' => array(
        'handler' =>'uc_order_handler_field_ship_date',
          'click sortable' => TRUE,
         ),
         'sort' => array(
           'handler' => 'views_handler_sort',
         ),
         'filter' => array(
           'handler' => 'views_handler_filter_string',
         ),
      );
     }

I do have the ability to send through a UNIX epoch timestamp instead if that would help me make this sortable so long as I can sort by the epoch but render it as a formatted date.
The fact that this is an extension of ubercart bears no factor on the result. Treat this question as if it were just a simple implementation of the views module, which in essence it is.


texts: Modal form - cant set error message, and no message for required field

texts:
In a modal form, i've got e email field that is required.

when the field is wrong, a error message is well displayed
when the field is empty, $form_state->hasAnyErrors() is true but there is no error message
when i whant to set the error message in the form validation function, it's stay empty !

in BuildForm :

  $form['email'] = array(
            '#type' => 'email',
            '#required' => true,
            '#attributes' => [
                'placeholder' => t('Your email'),
                "data-nluid" => $nluid
            ],
        );
$form['actions']['submit'] = [
                '#type' => 'submit',
                '#value' => t('Suscribe'),
                '#ajax' => [
                    'callback' => '::submitModalFormAjax',
                    'wrapper' => 'newsletter_add_modal',
                    'event' => 'click'
                ]
            ];

in validateForm

 public function validateForm(array &$form, FormStateInterface $form_state) {
        $emailValue = $form_state->getValue("email");
        if (!\Drupal::service('email.validator')->isValid($emailValue) || trim($emailValue) == "") {

         $form_state->setErrorByName('email', "Email is required and must be valid");
         //binding form_state->getError($form['email']) show empty string
        }
    }

in submitModalFormAjax

 // If there are any form errors, re-display the form.
        if ($form_state->hasAnyErrors()) {
            $response->addCommand(new ReplaceCommand('#newsletter_add_modal', $form));
        } else {
 // else, exec success behavior

What am I doing wrong?


texts: How can the content of the HTML in RSS be extracted info fields even if they are not in the RSS it self?

texts:
As RSS files do not contain the actual content of the pages, how can a feed processor load the HTML in the linked page and extract some content from it into the target content type?

Coming to think of it isn't actually an RSS issue, it is about taking a list of URLs, loading the actual pages and extracting data elements from them into the fields of a content type.

Do some of the node processors have that capability?


texts: Push Notifications: How can I send extra parameters in push notification data?

texts:
I am using Push Notifications module to send notification to registered tokens.

I am able to send a plain text notification successfully via rules.

I am looking for a way to send the notification with extra fields so that it can be identified which type of notification is this and what action to take on this.

Below is the data example I need to send the notification in:

{
   "aps":{
      "alert": "Enter your message",
      "badge":1,
      "sound":"default",

     "extraField 1":"some value",
     "extraField2":"identifier"
   }
}

Here is the rule export:

    {
    "rules_push_notification" : {
    "LABEL" : "Push Notification",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "REQUIRES" : [ "rules", "push_notifications" ],
    "ON" : { "node_insert" : [] },
    "IF" : [
      { "node_is_of_type" : {
          "node" : [ "node" ],
          "type" : { "value" : { "music" : "music", "news" : "news" } }
        }
      }
    ],
    "DO" : [
      { "push_notifications_send_message_bulk" : { "message" : "[node:title]", "target_group" : "authenticated" } }
    ]
  }
}

Notes:

My Rules Action maps (corresponds) to the data example like so: that "Enter your message" would be replaced by the value of "[node:title]".
About that "extra field 1" (and "extra field 2"): When I send a Push notification, On Tap it needs some action to be taken which is decided in those extra fields, for an example if I need to show a music article I will send "music" as identifier and second field will be the node id of the content help mobile to open that particular article.


texts: How can I unpublish the content profile node when users update their user account?

texts:
I would like to unpublish automatically the content profile node of the users who updates their user account at user/%/eidt.

I found a event "User account details have been updated" in Rules but didn't find the action to unpublish their content profile node.


texts: how to access drupal site using domain containing host ip address as prefix

texts:
My drupal site works in local domain dev.example.com (which is configured as a virtual host).

For some reason, now I need to access the site using exactly the following address:

http://192.168.3.149/dev.example.com

where 192.168.3.149 is the IP address of the local host where the site resides.

When this address is entered, I am redirected to http://192.168.3.149/install.php. Looks like Drupal treats this as a new domain.

How to tell Drupal to treat these two domains identically, i.e. treat http://192.168.3.149/dev.example.com as an alias of http://dev.example.com ?


texts:
I am using Drupal 7 with the WebForm and MIME Mail modules.

I've got webform attachments being sent in the email working fine. However the email also contains a path to view the email in a directory on the server. Currently, it's set to /sites/default/files/webform/sites/default/files/webform/ /.

How can I change the directory where WebForm submissions are stored?


texts: Views Exposed TID Filter Hidden Behind Body

texts:
Hello i have an exposed filter on my view allowing folks to seach by term. When folks start typing though only the first option on the list is shown and he rest is hid behind the body of my website.

You can view it here-
my exposed filter

Its the 2nd from the left in the red bar view up top.

Its driving me mad.

thanks


texts: Rewrite taxonomy_term_reference urls to read /taxonomy/term/(name)

texts:
After creating a view to allow /taxonomy/term/(name) to show content tagged with that term, I am trying to find where I can override the generation of field links (field_type_taxonomy_term_reference) so that they create links following this format. Currently they still show the id number for the term at the end. I have tried (mytheme)_preprocess_taxonomy_term and altering $variables['term_url'] but that hasn't worked. Can anyone please give me any pointers about how to do this, I am running out of ideas.

Any thoughts welcome.

Cheers
Paul


texts: Why is the backup of the site not behaving the same as the original?

texts:
I've cloned my site onto a testing server prior to making changes (database and all files), but it's not behaving like the original, and I'm unable to login.

The site was at www.original.com/drupal/ and www.original.com/node/3 works.
The test site is at www.test.com (note no /drupal) and www.test.com/node/3 gives me an Apache 404 error page.

Why are the two sites not behaving the same?
No Drupal specific content resides above www.original.com/drupal.


texts: How to create a user with custom profile fields for a SimpleTest

texts:
How can I programmatically create a new user for use during a SimpleTest?  The user must have certain custom fields populated during the registration.

I'm using $this->drupalPost('user/register', $edit, 'Create new account'); to create the account currently as I do not see a way to populate custom profile fields with drupalCreateUser().

$edit = array(
      'name' => $this->randomName(17),
      'mail' => $this->randomName(17) . '@example.com',
      'field_owner_first_name[und][0][value]' => $this->randomName(17),
      'field_owner_last_name[und][0][value]' => $this->randomName(17),
      'field_owner_title[und][0][value]' => $this->randomName(8),
      'field_business_name[und][0][value]' => $this->randomName(17),
      'field_business_phone[und][0][value]' => mt_rand(200, 999) . '-' . mt_rand(200, 999) . '-' . mt_rand(1000, 9999),
      'field_business_email[und][0][value]' => $this->randomName(17) . '@example.com',
      'field_business_website[und][0][value]' => 'http://' . $this->randomName(17) . '.com',
      'field_business_address_1[und][0][value]' => mt_rand(1, 9999) . ' ' . $this->randomName(12) . ' ' . $this->randomName(2),
      'field_business_address_2[und][0][value]' => 'Apt ' . mt_rand(1, 999),
      'field_city[und][0][value]' => $this->randomName(8),
      'field_state[und]' => 'HI',
      'field_zip[und][0][value]' => mt_rand(10000, 99999),
      'field_request_website[und]' => 'Yes',
);
$this->drupalPost('user/register', $edit, 'Create new account');

The code above successfully completes and posts the registration form.

How can I automatically approve and login as this newly submitted user for testing?  Do I need to write tests to login the admin account, find and then approve the user?

Additional Thoughts and Clarification:

Looking at other options, can I somehow use variable_set() to accomplish the automated user approval above when the setUp() method is called?


texts: Is there any option to add file upload/attachment field in webform?

texts:
Is there any option to add file upload/attachment field in webform for Drupal 8?

My webform version is 8.x-5.0-beta7+20-dev


texts:
When I hit

  Administration > Configuration > Regional and language

There is no language option in drupal 7 site. Could I need to install modules? Which modules can I install?


texts:
In my module I created a function called: functuion specialblocks_access. Right now the function allows a action only if the user created that content. However I want to specifiy the type of content (Example: access to Blog content but not Basic Page Content if conditions met). I have added: if ($content->type=="blog"){ } to the below code to specifiy blog content. However the code doesn't work. If I delete that line of code I just mention, it works but it allows all content. I want to specifiy the type of content.

Code:

function specialblocks_access($sOp, $sType = NULL, $iDelta = NULL) {
  //Users with administer hotblocks can do whatever they want

  if (user_access('administer specialblocks')) {
    return TRUE;
  }

  //This check determines whether the user can do any operations to a given block
  //(not an item in the block, but to the block): assign, create, or order
   **if ($content->type=="blog")**{
  if (preg_match('#node/([0-9]+)#', $_GET['q'], $matches)) {
              if ($node = node_load($matches[1])) {
                global $user;
                if ($user->uid == $node->uid) {
  if($sOp == 'any block controls') {
    if (specialblocks_access('assign items to any specialblocks', NULL, $iDelta)) {
      return TRUE;
    }

}
}
}
**}**


texts:
I want to change TB Mega Menu
Dropdown on hover to Toggle on click. I tried inserting attributes using this jQuery

$("li.dropdown.parent > a").attr("class", "dropdown-toggle");
$("li.dropdown.parent > a").attr("data-toggle", "dropdown");
$("li.dropdown.parent > a").attr("aria-haspopup", "true");
$("li.dropdown.parent > a").attr("aria-expanded", "false");

But cannot work correctly. Toggle is working but hover dropdown is still active. Is there a better way to do it.


texts:
I am trying to use the drupal_slider module (https://www.drupal.org/project/drupal_slider) in a clean, just installed Drupal 8.8.5 because it may provide a way to overlay text over the image.

Setup:

Created a content type called "Slide" w/Title, Body and Image.
Created 4 slides with images
Modified Media > Drupal Slider to add a Slide and Slide Group
Created a View that almost looks exactly like the sample on the module page

Format: Drupal Slider
Show: Fields
All Slide content fields, but are hidden
Include Field Global:Drupal Slider Layers
Pulled the field variables from the list of REPLACEMENT VARIABLES (automatically listed based on the content fields pulled in) to make sure I'm referencing the correct machine names. For reference you have to put the Drupal Slider Layers after (under) the fields in the list in order for the REPLACEMENT VARIABLES to detect them.
Background Image = {{ field_slide_image }}
Layer 1 = {{ title }} and {{ body }}

The output shows a broken image icon instead of the background image, then it shows the text from the {{ title }} and {{ body }} fields.

If I manually add the image field (stop excluding from display) the image shows up, but not through the Slider.

So the problem is

Image file is not getting pulled or displaying in the Drupal Slider Layers.
Even though the View is set to Format: Slideshow it is showing as list

Am I missing a step or setting, or is Drupal Slider broken in Drupal 8?


texts:
I have my main site as example.com and also I am running the below subdomains with help of subdomain module

one.example.com
two.example.com

I have created the html block(admin/structure/block/add) for footer to list my site links. This block is visible for main domain(example.com) and all subdomains(one.example.com,two.example.com)

But I have URL issues in that footer block in subdomains.
For example I have Suggestions in footer block, when I am in main domain it goes to http://example.com/suggestions. It goes to http://one.example.com/suggestions & http://two.example.com/suggestions when I am in subdomains.

BUT IT SHOULD GOES TO ONLY http://example.com/suggestions FOR ALL SUBDOAMINS

Any way to achieve this?


texts: Administrator unable to view "Registration" pages

texts:
If I log in as admin and want to edit the registration pages; I can not access the pages.
I can only see them if logged out but, obviously, if logged out I do not get the "edit" option.

Where do I change the viewing permissions, so that the admin can always view all pages?


texts:
I was reading up on AJAX requests in Drupal 7 at http://codekarate.com/blog/drupal-7-javascript-ajax-framework-example-link

Where the AJAX framework is explained in detail, when used on custom links and potentially other HTML elements.

Now it got me wondering,

In a more "custom" point of view, I have created some (regular) hook_menu() implementations in the past, (without any /ajax or /nojs stuff) that would just return json data.

So, basically I implemented links in my custom module that would get called via a custom jQuery file (via $.post or $.get), via a click() event or something like this, that in turn fired the hook_menu() mentioned above.

This would then return some json data after processing the request, this returned data would get fetched by my jQuery script, and the DOM would be updated with the data that was returned by the ajax call (json, ...).

Now I am just wondering on the pro's and con's of both ways of doing things.

It figures that the first one is more "the Drupal way", and the second one is much more custom...

Since I never had any issue with using the second way of things, I am very curious to hear what you all have to say on this matter.

Thanks in advance.

Best

Guardian


texts: I'm using Shoutbox module, but I got problem. AJAX refresh is working only when I submit a message first, is this possible to enable AJAX refresh automatically on page load?


texts:
I am working on the node edit form, and I want to remove all field validation when users click on Save as unpublished.

Is it possible?

I didn't write any code right now, so I don't have any code to show.


texts: Allow only lowest taxonomy terms to assign to nodes

texts:
I have a lot of taxonomy terms that need to be categorized into multiple categories and subcategories:

- AAA
  - BBB
    - CCC
    - DDD
    - EEE
...

Is there a way how to restrict assigning higher terms to nodes (AAA, BBB) and allow to use only lowest terms (without any child terms - CCC, DDD, EEE)?


texts: Set value to specific custom theme setting

texts:
I noticed that I can get a specific theme setting like so

theme_get_setting('myvar','mytheme');

but I don't see a way of actually setting a setting. Something along the lines of

theme_set_value('myvar','mytheme','value');
I looked at the functions available to me here https://api.drupal.org/api/drupal/core%21includes%21theme.inc/8.2.x
but I didn't see anything specific to my needs.

I do see there's already a question asking the same thing here
How to set theme setting
but that is for Drupal 7 and I'm using 8.

Is there a quick way to set the value of a specific theme setting?


texts: Problem in uploading an image to my drupal site

texts:
My Drupal site contains images and videos of an event. I got a problem with image module. When I am uploading image an error "The file could not be uploaded" is displayed. I set the formats as jpg, jpeg, png.

I have a similar site in another server but it is free from this issue. It is uploading images smoothly.

How can I solve this?


texts:
I built a site with the theme Corporate Clean. I wanted to add some custom CSS (override some colors, fonts etc.) so I added this to the files in the folder /sites/all/themes/corporateclean/...). Now an update for the theme became available and I lost all my custom styles (I have them in source control so no panic).

What is the best way to add custom css that doesn't disappear when a new theme version is published? I prefer file based. I've seen CSS Injector but that CSS would also be gone if I start from a new database.


texts: How to add/modify new taxonomy terms in node edit form? (taxonomy type is not tag)

texts:
For example, when adding/editing a node, if a needed taxonomy term(category) doesn't exist, then for the user with right permission, he/she can then add a new term without leaving the node editing form? The term should be hierarchical not like tags, for example the category of the content.

I believe I saw a module which can handle this type of thing by providing a button to create new taxo

Thanks!


texts: Where to translate SHOW DETAILS from a display view?

texts:
I would like to find out where would I be able to translate the SHOW DETAILS/HIDE DETAILS menu options a DATATABLES FORMAT view.
We are using Drupal 7, and I have tried to find it in the Configuration options, with no success. Would this need to be changed in the back end of Drupal?


texts: New link added in user page but not visible to non admin user in Drupal 7

texts:
I added this module in Drupal 7 for adding new tab in my site. This new tab is not visible to non admin  user. Only visible to admin. I also tried to set permission in this direction admin> People> permission but this there is no module by the name "New tab" is visible. Please help.

function newtab_menu() {
  $items = array();

  $items['user/%user/new_tab'] = array(
    'title' => 'New tab title',
    'page callback' => 'drupal_get_form',
    'page arguments' => array('newtab_newtab_form', 1),
    'access arguments' => array('access new tab'),
    'type' => MENU_LOCAL_TASK,
  );

  return $items;
}

function newtab_newtab_form($form, &$form_state, $account) {
  // ...
}

function newtab_permission() {
  return array(
    'access new tab' => array(
      'title' => t('The title of the permission'),
      'description' => t('The description of the permission'),
    ),
  );
}


texts: How to remove mymodule configurations on uninstall

texts:
I have created a custom module and created a yml file to create a menu

system.menu.custom_menu.yml

id: custom_menu
label: 'Custom menu'
description: 'Custom menu.'
langcode: en
locked: true
dependencies:
  - mymod

When I installed my module it creates the the custom menu.
But then When I uninstall the module and try to install it again I get the following exception

exception 'Drupal\Core\Config\PreExistingConfigException' with message 'Configuration objects (system.menu.custom_menu) provided by mymod already exist in active configuration' in
/var/www/drupal8/core/lib/Drupal/Core/Config/PreExistingConfigException.php:70

What I am doing wrong? Is there any way to remove my configuration (system.menu.custom_menu) from the configurations when I uninstall my module?


texts:
When validating an email address using the code below I get this error when i run the same code from within a drupal node, where I coded a form using php/html

if (filter_var($email, FILTER_VALIDATE_EMAIL) === FALSE) {
$errors[] = 'Please enter valid email';
}

I get this error:

Fatal error: Call to undefined function filter_var() in /var/www/html/drupal1/includes/common.inc(1743) : eval()'d code on line 53


texts:
I'm building a webshop with a lot of promotions in. And some articles in the shopping cart, have a linked promotion. And I want to show this promotion in the shopping cart summary (before the order completion).

Is there a way to change the title of the product in the shopping cart summary?

It's a shop without any visible prices. The total amount of the order is calculated on the servers... (it's a complicated proces). So there is nothing to worry about that...

But how can I display the pink text in a proper way? Would it be best to get this data from the database and place it as a field in a table (since the shopping cart summary is a view)? Or what other options do I have?


texts: Show jCarousel if number of items are more than 3

texts: I am using the jCarousel Views module; I want to hide the view when the number of items are not greater than 3. How do I do it?


texts:
I have created a custom view for my Drupal 7 front page, and I have named it "Recent Products", but this view is only working for the front page is not working in taxonomies, tags, content preview pages.

How do I apply this view for every page, or set it as default for pages?


texts: I need to install a module that permit me (on my site) to ban IP. I have searched on Drupal.org and Google.com, but seems that there is not a good solution. All modules seems abandoned, so I ask here if someone use one of these modules and which one use. I don't want to start a thread about which is the best, only know which one I can use.


texts: How do I add classes to main menu ul and li in Drupal 8

texts:
I want to generate the html elements and their classes to fit my styling of the main menu.

I'm confused by all the near-possibilities offered in the api documentation and by looking at core themes etc. and still can't quite see what I have to do, or where I have to do it.
I would be very grateful for clear pointers to:

which php functions I have to write;
which variables I need to add / update;
in which files the functions will go.

Presumably, in MYTHEME.theme I will need a preprocess function of some sort to add to the attributes and item.attributes variables that links.html.twig uses to print the menu ul and the menu item li's.

[Update]
So far I have discovered one way to place classes on the Main Menu's ul but ideally I would like to add a class to each submenu's ul indicating the depth of the sub-menu.
And I cannot locate any documentation or examples from which I can understand the generation / modifying of the main menu's individual link items.

This function goes into the file  MYTHEME.theme.

function MYTHEME_preprocess_page(&$variables) {

  // Pass the main menu and secondary menu to the template as render arrays.
  if (!empty($variables['main_menu'])) {
    $variables['main_menu']['#attributes']['id'] = 'main-menu-links';
    $variables['main_menu']['#attributes']['class'] = array('links', 'clearfix', 'MYNEW_class');
  }

}


texts:
I just took a first look on the RNG Module. In the Readme, it is called the successor of the Drupal Entity Registration Module.

Is there a wait-list functionality planned or already implemented?
Maybe I'm not getting it right and its already implemented via Rules?

Any help would be welcome...


texts: How to Modify Drupal 7 Bootstrap Theme Title?

texts:
I cannot find where to modify the title from:

SiteName | SiteSlogan

to

SiteName - SiteSlogan

I am using the https://drupal.org/project/bootstrap theme.

Anyone have any ideas?


texts: How can I sort Views output by whether or not field content matches a string?

texts:
I feel like there must be a module for this, but I can't find one.

What I have is a field with 4 possible values. I want to sort items with a specific one of the values to the top, then everything else in order by creation date.

In SQL, the query would look something like this:

SELECT fields FROM table ORDER BY textfield = "text" DESC, datefield


texts: Define fields created through the UI as non-revisionable on a revisionable entity

texts:
Let's say, I have a revisionable entity. Whether base fields should be revisionable or not can be set in the code. So far, so good.
But how about those fields that get added through the user interface? Is there a way to set all the fields as either revisionable or non-revisionable? Or is there a way to set this for each field individually in the UI?


texts:
I'm trying to move a drupal 7 install from one server to the other. I'm able to move the files and export/import the database fine. After tweaking settings and clearing caches the site displays fine. All links work, all paths work.

The only problem I'm having is that I've got a custom content type with an image field. The image field is showing up as a field under the "manage fields" tab, but the type of field is not displaying.

Also I cannot use this field in any views or in the theme at all.

All of the data for the field is there, and it seems like everything is joined in the db correctly, but that could be the issue. I've checked permissions and php settings compared to the old server and everything seems consistent.

I have no idea what to even look for to troubleshoot. I tried running a test using the testing module against the image module but that wouldn't run either. It gave me the error "Attempt to create a field of unknown type"

I've also run cron, purged caches, re-run the data transfer, and tried to update the fields through admin. I've also checked all modules and just updated everything I can find in drupal. Nothing is working.

Any ideas on other things I can try or look to to try to troubleshoot this? I'm at a loss at this point.


texts: Ajax on Autocomplete does not fire again, if previously fired

texts:
I am using Drupal 6, and question is regarding autocomplete.
As a part of performance, I am caching the results of AJAX calls, so that if the same values are passed, we dont have to fire ajax call again, and should get the result instantly.

Scenario
I have 2 autocomplete fields, one coming from Drupal taxonomy module, for tags and the other is a custom autocomplete field added via form alter, fetching some other information from custom table.

While I was checking on the Drupal default autocomplete field for tags, I saw that the if I insert the same text, the ajax is not fired.
Like I insert "I", I get some values, change it to "j", I get some other values, If I change it back to "I", NO ajax is fired.
However, for my custom autocomplete field, i am able to see 3 ajax calls.

Can someone please put some light as to how drupal does it, so that even i can implement the same on our custom field as well.
I am using drupal 6, but if you are aware of how it is done in Drupal 7 as well, it would be a great help.


texts:
When I enable Apache solr, everything works perfectly fine except for the following scenario.

When I do a keyword search using character - (minus symbol), or +, I get the error:

  The Apache Solr search engine is not available. Please contact your site administrator.

Do you know why this happens?


texts: How can I have different image size for a content type

texts:
I have 3 type of products that I want to put their image in my site. I have define a content type for them. there is a field that I put the image of my products and I've use imagefield crop module to crop my images but the problem is I don't want any specific ratio for my pictures or at least I have 3 define ratio for my images(each for a product).
I would appreciate if you tell me how can I set the different image size for my product with just one content type?
TNX

Edit:
for example I have chosen the "Image with cropping" as a widget of my field in a content type and because in its option I should fill the blank of the "resolution of cropped image" I set 300x300 like this:

Then when I crop my product option it gave me this:
for 136x65

After Cropping

or for 170x300

After

And I should decide whether my image is square size or rectangular ??


texts: What's wrong with a new installation of Drupal 8.6.10?

texts:
A fresh install of Drupal results in a WSOD including a very helpful error message which says "The website encountered an unexpected error. Please try again later."

I normally install Drupal with the drupal-project template from github and at first, I thought this was a problem with my local DDEV environment. I then tried with MAMP Pro to find exactly the same.

Finally I tried on simplytest.me to realise that it isn't me.

A look at my local error logs reports the following;

"NOTICE: PHP message: Uncaught PHP Exception Twig\Error\SyntaxError:
An exception has been thrown during the compilation of a template
("Attribute "name" does not exist for Node
Twig\Node\CheckToStringNode) in
core/themes/bartik/templates/block--system-menu-block.html.twig"." at
/var/www/html/public_html/vendor/twig/twig/src/Environment.php line
797"

I found that is was possible to access the site via the admin path, and changing the theme to Stark allowed me to view the site.

I then attempted to view recent system messages at admin/reports/dblog - only to once again to get the "Please try again later" message.


texts: How can I encrypt the username and email address in the database, to protect against emails being stolen from a compromised database (D7)

texts:
Is there a way to encrypt the following user fields in the database so that they cannot be retrieved from a compromised database?

Username
Email address

A solution to encrypt the whole database would also be great.


texts:
So, like everyone, when I came accross the requirement to incorportate maps into my Drupal site, I googled for solutions and that pretty much led me straight to the Openlayers/Geofield solution. Not even sure there is another acceptable out-of-the-box module out there.

Anyway, the module works wonders, it delivers perfectly but I have some questions/issues regarding performance.

What I need to represent in my map, are user entities. The users have a "Location" field, which is a geofield autocomplete. The site (largely due to migrationg) numbers 10.000 users currently. Granted, not all of them will actually be active, but in the worse case scenario, trying to load all 10k users results in very high waiting time in the Data Overlay step meaning the production of 10k projection items for the map to display.

Since the location field was not migrated, I initially filtered by having the field NOT NULL. This will skip querying for useless entities. But as I said, having 10.000 "active" users, who have edited their data and filled in that field might cause a system overhaul when people try to view the map.

Question 1: Could the fact that I was querying for users with Location values of NULL have resulted in higher waiting time? I mean, 10.000 users with actual data may get processed faster than 9.000 users with NULL set as location?

Question 2: Are there any general suggestions to somehow improve the map's performance? Reminding that the delay occurs in the projections' production process.


texts:
First I am not very good in JavaScript so maybe I do not know some very basics... I apologize in advance.
I created a form where I want to save every change in single fields directly without the need to submit the form each time. Therefore I created a custom route which returns an AjaxResponse on successfull database savings as well as on any errors on the Drupal side.
But I want to be aware of any errors which may appear on the client side as well. $.ajax() has the function .fail() and .done() where I can do different things in my JavaScript when something went wrong. These methods are missing for Drupal.ajax(). Is there any way to react on errors when using Drupal.ajax()?
I tried
try {
  Drupal.ajax({url: path}).execute();
}
catch (e) {
  alert(e.name + ": " + e.message);
}

and built in some errors on my controller but all that happens is that the browsers console lists Ajax errors - no alert is shown to the client.


texts: Theme a Panelized Content Type Not Working

texts:
I'm trying to add a content type to an existing site. I've added it, panelized it, added fields, and everything seems to be working well. There is a second panelized content type in this site that is being themed from a file titled node--typename.tpl.php and is working correctly.

I attempted to name mine node--my-typename.tpl.php, cleared all caches, but nothing works.

I drush vset theme_debug 1 and checked for tpl suggestions but it doesn't really mention anything pertaining to theming the content type—just panelizer.

Is there a setting I'm missing here? I've combed through both content types and can't see a difference but one allows theming using node-- files and the other doesn't.


texts: Add fields to a coded block and use them in a templated block

texts: I want to programmatically create a block to which I can add a body field, a link and an image and then create a block twig template file where I can use these fields. For the uploaded image ideally I would want to be able to use a responsive image style. Am hoping someone someone can tell me how I would do this?


texts:
I have a website that will need an age gateway because it contains content about alcohol.  I'm looking for an easy way to do this, without needing to create a custom module because I haven't done any and the deadline is looming.

It would need to redirect to a page gathering age information, and only allow access to the site if >= 21 years old.  Specific pages would be exempt.

If anyone knows a module that takes care of this, or has any ideas I'm open to suggestion.